77% accelerated-mobile-pages

Code Review | AMP for WP - Accelerated Mobile Pages

WordPress plugin AMP for WP - Accelerated Mobile Pages scored 77% from 54 tests.

About plugin

  • Plugin page: accelerated-mobil...
  • Plugin version: 1.0.77.39
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.9.2
  • WordPress version: 5.9.2
  • First release: Feb 7, 2016
  • Latest release: Apr 5, 2022
  • Number of updates: 400
  • Update frequency: every 1.6 days
  • Top authors: mohammed_kaludi (100%)

Code review

54 tests

User reviews

1215 reviews

Install metrics

100,000+ active / 14,919,250 total downloads

Benchmarks

Plugin footprint 81% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲10.32MB] [CPU: ▼231.90ms] 50% from 4 tests

Server-side resources used by AMP for WP - Accelerated Mobile Pages
Please have a look at the following items
  • RAM: Total memory usage should be kept under 10MB (currently 18.74MB on /wp-admin/admin.php?page=amp_options&tab=31)
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 10.32MB on /wp-admin/admin.php?page=amp_options&tab=31)
PageMemory (MB)CPU Time (ms)
Home /9.81 ▲6.30110.10 ▲46.79
Dashboard /wp-admin15.41 ▲12.01119.71 ▲71.88
Posts /wp-admin/edit.php15.09 ▲11.45122.65 ▲75.60
Add New Post /wp-admin/post-new.php19.60 ▲12.63186.72 ▼1,121.86
Media Library /wp-admin/upload.php14.82 ▲11.52136.63 ▲104.39
AMP /wp-admin/customize.php?autofocus[panel]=amp_panel&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F&customize_amp=118.02145.07
Import / Export /wp-admin/admin.php?page=amp_options&tab=3318.74139.91
Design /wp-admin/admin.php?page=amp_options&tab=1918.74138.62
Settings /wp-admin/admin.php?page=amp_options&tab=218.74138.61
Setup /wp-admin/admin.php?page=amp_options&tab=118.74136.85
Documentation /wp-admin/admin.php?page=amp_options&tab=3218.74142.04
Extensions /wp-admin/admin.php?page=amp_options&tab=3018.74136.53
Widgets /wp-admin/widgets.php16.69121.44
Menus /wp-admin/nav-menus.php14.86110.26
Upgrade to Pro /wp-admin/admin.php?page=amp_options&tab=3118.74133.68

Server storage [IO: ▲17.45MB] [DB: ▲0.04MB] Passed 3 tests

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 1,169 new files
Database: no new tables, 9 new options
New WordPress options
ampforwp_rewrite_flush_option
widget_ampforwp_amp_code_widget
ampforwp_cpt_generated_post_types
ampforwp_plugin_info
widget_recent-comments
widget_recent-posts
ampforwp_default_pages_to
redux_builder_amp-transients
redux_builder_amp

Browser metrics 75% from 4 tests

This is an overview of browser requirements for AMP for WP - Accelerated Mobile Pages
A great user experience is important, so you should focus on the following
  • Nodes: For the best user experience, please reduce the number of DOM nodes under 25,000 (currently 29,387 on /wp-admin/admin.php?page=amp_options&tab=2)
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /5,398 ▲1,67220.77 ▲5.307.23 ▼1.052.52 ▼0.22
Dashboard /wp-admin4,469 ▲1,5899.20 ▲2.72198.99 ▲32.99193.49 ▲8.95
Posts /wp-admin/edit.php4,252 ▲1,5614.00 ▲0.57116.83 ▲42.50178.49 ▲10.55
Add New Post /wp-admin/post-new.php3,777 ▲2,14222.98 ▲6.90594.08 ▲84.91241.70 ▲55.48
Media Library /wp-admin/upload.php3,253 ▲1,5567.21 ▲1.47182.58 ▲12.32263.36 ▲36.49
AMP /wp-admin/customize.php?autofocus[panel]=amp_panel&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F&customize_amp=18,57320.43654.46243.39
Import / Export /wp-admin/admin.php?page=amp_options&tab=3329,28910.45381.00500.87
Design /wp-admin/admin.php?page=amp_options&tab=1929,35211.57420.62564.89
Settings /wp-admin/admin.php?page=amp_options&tab=229,38711.45391.00527.66
Setup /wp-admin/admin.php?page=amp_options&tab=129,28910.91352.69491.84
Documentation /wp-admin/admin.php?page=amp_options&tab=3229,29610.38373.78486.95
Extensions /wp-admin/admin.php?page=amp_options&tab=3029,36711.06353.03473.07
Widgets /wp-admin/widgets.php4,40632.56666.82189.24
Menus /wp-admin/nav-menus.php3,8694.25137.73162.24
Upgrade to Pro /wp-admin/admin.php?page=amp_options&tab=3129,30910.04382.39471.44

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie WordPress options were found after uninstall: 9 options
    • redux_builder_amp-transients
    • widget_recent-comments
    • ampforwp_default_pages_to
    • widget_ampforwp_amp_code_widget
    • ampforwp_rewrite_flush_option
    • redux_builder_amp
    • ampforwp_plugin_info
    • ampforwp_cpt_generated_post_types
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/accelerated-mobile-pages/install/assets/images/spinner.php
    • > /wp-content/plugins/accelerated-mobile-pages/includes/vendor/css-parser/sabberworm/php-css-parser/tests/quickdump.php
    • > /wp-content/plugins/accelerated-mobile-pages/templates/design-manager/swift/footer.php
  • 82× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/ParserTest.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Optimizer\\Configuration\\BaseTransformerConfiguration' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Configuration/AmpRuntimeCssConfiguration.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'AMP_HTML_Utils' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/templates/single.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/back-compat/templates-v0-3/meta-time.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Optimizer\\Transformer' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Transformer/TransformedIdentifier.php:26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/templates/meta-time.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Exception\\AmpCliException' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Exception/Cli/InvalidCommand.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Optimizer\\Exception\\AmpOptimizerException' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Exception/InvalidConfiguration.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Optimizer\\TransformerConfiguration' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Configuration/BaseTransformerConfiguration.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Optimizer\\Transformer' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Transformer/ServerSideRendering.php:40

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed: You can look at the official readme.txt

accelerated-mobile-pages/accelerated-moblie-pages.php 92% from 13 tests

The primary PHP file in "AMP for WP - Accelerated Mobile Pages" version 1.0.77.39 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("accelerated-mobile-pages.php" instead of "accelerated-moblie-pages.php")

Code Analysis 97% from 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
There were no executable files found in this plugin163,594 lines of code in 941 files:
LanguageFilesBlank linesComment linesLines of code
PHP54911,61920,284110,569
JavaScript2096,1374,61632,589
CSS1078182879,686
Sass52625605,588
SVG41821,603
Markdown644301,425
JSON518401,034
LESS38279715
HTML5453330
Bourne Shell124055

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 117)
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity21.45
▷ Minimum class complexity1.00
▷ Maximum class complexity871.00
Average method complexity4.40
▷ Minimum method complexity1.00
▷ Maximum method complexity117.00
Code structure
Namespaces29
Interfaces22
Traits1
Classes326
▷ Abstract classes164.91%
▷ Concrete classes31095.09%
▷ Final classes7122.90%
Methods2,118
▷ Static methods31815.01%
▷ Public methods1,62376.63%
▷ Protected methods1647.74%
▷ Private methods33115.63%
Functions1,014
▷ Named functions95494.08%
▷ Anonymous functions605.92%
Constants649
▷ Global constants243.70%
▷ Class constants62596.30%
▷ Public constants625100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
161 compressed PNG files occupy 3.71MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/cache-icon.png1.46KB1.52KB0.00%
images/bbp-icon.png1.83KB1.84KB0.00%
images/messenger.png21.07KB23.03KB0.00%
includes/vendor/amp/assets/images/placeholder-icon.png0.46KB0.24KB▼ 48.41%
images/amplayouts.png0.70KB0.71KB0.00%