83% amp

Code Review | AMP

WordPress plugin AMP scored83%from 54 tests.

About plugin

  • Plugin page: amp
  • Plugin version: 2.5.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4
  • WordPress version: 6.3.1
  • First release: Oct 8, 2015
  • Latest release: Nov 6, 2023
  • Number of updates: 166
  • Update frequency: every 17.8 days
  • Top authors: westonruter (81.93%)batmoo (18.07%)philipjohn (1.2%)

Code review

54 tests

User reviews

359 reviews

Install metrics

400,000+ active /13,494,828 total downloads

Benchmarks

Plugin footprint 81% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲9.69MB] [CPU: ▲44.76ms] 25% from 4 tests

This is a short check of server-side resources used by AMP
Please fix the following
  • RAM: The total memory usage must be kept under 10MB (currently 13.42MB on /wp-admin/edit-tags.php?taxonomy=amp_validation_error&post_type=amp_validated_url)
  • CPU: Total CPU usage must kept under 500.00ms (currently 645.90ms on /wp-admin/options.php?page=amp-onboarding-wizard)
  • Extra RAM: The extra memory usage must be under 5MB (currently 9.69MB on /wp-admin/edit-tags.php?taxonomy=amp_validation_error&post_type=amp_validated_url)
PageMemory (MB)CPU Time (ms)
Home /13.23 ▲9.7787.44 ▲46.40
Dashboard /wp-admin13.41 ▲10.1192.03 ▲44.35
Posts /wp-admin/edit.php13.41 ▲10.0699.99 ▲53.03
Add New Post /wp-admin/post-new.php14.69 ▲8.80125.90 ▲35.24
Media Library /wp-admin/upload.php13.41 ▲10.1886.63 ▲56.17
AMP Onboarding Wizard /wp-admin/options.php?page=amp-onboarding-wizard15.42645.90
Settings /wp-admin/admin.php?page=amp-options15.38360.22
Support /wp-admin/admin.php?page=amp-support14.1587.52
Validated URLs /wp-admin/edit.php?post_type=amp_validated_url17.4197.12
Error Index /wp-admin/edit-tags.php?taxonomy=amp_validation_error&post_type=amp_validated_url13.4281.66

Server storage [IO: ▲9.10MB] [DB: ▲1.37MB] Passed 3 tests

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 1,564 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
amp_url_validation_queue
widget_recent-posts
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by AMP
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,936 ▲14914.38 ▲0.042.73 ▲0.6236.69 ▼6.75
Dashboard /wp-admin2,308 ▲1315.64 ▼0.0195.81 ▼6.0945.56 ▼0.69
Posts /wp-admin/edit.php2,197 ▲972.06 ▲0.0541.46 ▲5.7834.36 ▲0.81
Add New Post /wp-admin/post-new.php1,596 ▲7023.23 ▲0.20776.43 ▲1.1948.41 ▼11.01
Media Library /wp-admin/upload.php1,479 ▲794.29 ▲0.15101.92 ▼3.7848.82 ▲5.52
AMP Onboarding Wizard /wp-admin/options.php?page=amp-onboarding-wizard4243.2267.3956.80
Settings /wp-admin/admin.php?page=amp-options1,3087.24147.3647.91
Support /wp-admin/admin.php?page=amp-support1,0512.4152.2633.94
Validated URLs /wp-admin/edit.php?post_type=amp_validated_url1,7852.2337.4230.19
Analytics /wp-admin/admin.php?page=amp-options#analytics-options1,3397.40136.4542.10
Error Index /wp-admin/edit-tags.php?taxonomy=amp_validation_error&post_type=amp_validated_url1,3091.9535.8931.67

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
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
  • 1244× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Parsing\\SourceException' not found in wp-content/plugins/amp/vendor/sabberworm/php-css-parser/src/Parsing/OutputException.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Optimizer\\Transformer' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Optimizer/Transformer/ReorderHead.php:46
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Exception\\AmpException' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Optimizer/Exception/AmpOptimizerException.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Validator\\Spec\\Tag' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Validator/Spec/Tag/AmpNextPageSeparator.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Validator\\Spec\\Tag' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Validator/Spec/Tag/Dd.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\AmpWP\\BackgroundTask\\CronBasedBackgroundTask' not found in wp-content/plugins/amp/src/BackgroundTask/SingleScheduledBackgroundTask.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Cli\\Command' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Cli/Command/Optimize.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Validator\\Spec\\Tag' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Validator/Spec/Tag/StyleAmpRuntimeTransformed.php:35
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Validator\\Spec\\TagWithExtensionSpec' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Validator/Spec/Tag/ScriptAmpPositionObserver.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Validator\\Spec\\Tag' not found in wp-content/plugins/amp/vendor/ampproject/amp-toolbox/src/Validator/Spec/Tag/AmpStoryInteractiveResults.php:28

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

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
6 plugin tags: amp, page experience, accelerated mobile pages, performance, optimization...

amp/amp.php 92% from 13 tests

This is the main PHP file of "AMP" version 2.5.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 347 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin122,946 lines of code in 1,542 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,45316,63963,020122,429
JSON100263
JavaScript3006110
SVG1700100
CSS410144

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity6.64
▷ Minimum class complexity1.00
▷ Maximum class complexity491.00
Average method complexity3.60
▷ Minimum method complexity1.00
▷ Maximum method complexity59.00
Code structure
Namespaces61
Interfaces58
Traits4
Classes1,320
▷ Abstract classes272.05%
▷ Concrete classes1,29397.95%
▷ Final classes1,15689.40%
Methods2,775
▷ Static methods60621.84%
▷ Public methods2,10575.86%
▷ Protected methods1936.95%
▷ Private methods47717.19%
Functions320
▷ Named functions9228.75%
▷ Anonymous functions22871.25%
Constants5,242
▷ Global constants40.08%
▷ Class constants5,23899.92%
▷ Public constants5,238100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 compressed PNG files occupy 0.03MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/placeholder-icon.png0.24KB0.24KB0.00%
assets/images/amp-page-fallback-wordpress-publisher-logo.png27.72KB28.53KB0.00%