94% amp-woocommerce

Code Review | AMP WooCommerce

WordPress plugin AMP WooCommerce scored 94% from 54 tests.

About plugin

  • Plugin page: amp-woocommerce
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.3.2
  • WordPress version: 5.8.1
  • First release: Oct 17, 2016
  • Latest release: Feb 19, 2020
  • Number of updates: 139
  • Update frequency: every 8.8 days
  • Top authors: marqas (89.93%)ahmedkaludi (10.79%)

Code review

54 tests

User reviews

12 reviews

Install metrics

400+ active / 18,913 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.25MB] [CPU: ▼150.63ms] Passed 4 tests

An overview of server-side resources used by AMP WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.10 ▲0.2629.54 ▲3.23
Dashboard /wp-admin3.32 ▲0.2537.19 ▼3.86
Posts /wp-admin/edit.php3.44 ▲0.3239.07 ▲1.25
Add New Post /wp-admin/post-new.php5.68 ▲0.2473.07 ▼599.83
Media Library /wp-admin/upload.php3.26 ▲0.2625.80 ▼0.09

Server storage [IO: ▲0.38MB] [DB: ▲0.00MB] Passed 3 tests

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 43 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for AMP WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,712 ▲11115.98 ▲0.044.88 ▼1.2973.54 ▼3.94
Dashboard /wp-admin2,976 ▲806.11 ▼0.03115.55 ▼17.72169.14 ▼4.41
Posts /wp-admin/edit.php2,788 ▲483.37 ▲0.1364.15 ▼1.31142.96 ▲6.53
Add New Post /wp-admin/post-new.php3,831 ▲9518.65 ▼0.10419.47 ▼47.43163.76 ▲0.65
Media Library /wp-admin/upload.php1,798 ▲465.53 ▲0.04150.38 ▲10.48190.72 ▲7.71

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 6× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/amp-woocommerce/templates/layouts/single.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amp-woocommerce/inc/amp_woo_ajax_calls.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amp-woocommerce/inc/amp_woo_features.php:214
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/amp-woocommerce/templates/layouts/product-review.php:2
    • > PHP Notice
      Undefined variable: amp_blacklist_sanitizer in wp-content/plugins/amp-woocommerce/inc/class-amp-woo-blacklist.php on line 8
    • > PHP Warning
      Use of undefined constant AMP_WOO_INC_DIR - assumed 'AMP_WOO_INC_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/amp-woocommerce/inc/class-amp-woo-add-to-cart.php on line 2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
2 plugin tags: amp, woocommerce

amp-woocommerce/amp-woocommerce.php 92% from 13 tests

"AMP WooCommerce" version 1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Description: The description should be shorter than 140 characters (currently 160 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected5,132 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP244803214,973
JavaScript115159
SVG30056
Markdown19044

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity39.33
▷ Minimum class complexity12.00
▷ Maximum class complexity57.00
Average method complexity4.59
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods32
▷ Static methods00.00%
▷ Public methods825.00%
▷ Protected methods1546.88%
▷ Private methods928.12%
Functions36
▷ Named functions3494.44%
▷ Anonymous functions25.56%
Constants5
▷ Global constants480.00%
▷ Class constants120.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.02MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/placeholder.png15.33KB11.36KB▼ 25.86%
assets/home.png0.83KB0.58KB▼ 29.88%