79% amp-supremacy

Code Review | AMP Supremacy

WordPress plugin AMP Supremacy scored 79% from 54 tests.

About plugin

  • Plugin page: amp-supremacy
  • Plugin version: 2.0.13
  • PHP version: 7.4.16
  • WordPress compatibility: 1.0.01-4.8
  • WordPress version: 5.9.2
  • First release: Jul 28, 2016
  • Latest release: Jun 19, 2017
  • Number of updates: 127
  • Update frequency: every 2.6 days
  • Top authors: seosupremacy (100%)

Code review

54 tests

User reviews

17 reviews

Install metrics

300+ active / 79,762 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.10MB] [CPU: ▼295.76ms] Passed 4 tests

A check of server-side resources used by AMP Supremacy
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.0858.80 ▲10.47
Dashboard /wp-admin3.51 ▲0.1039.43 ▲3.83
Posts /wp-admin/edit.php3.79 ▲0.1546.25 ▲7.52
Add New Post /wp-admin/post-new.php7.04 ▲0.0797.66 ▼1,198.58
Media Library /wp-admin/upload.php3.46 ▲0.1628.01 ▲4.21

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 190 new files
Database: no new tables, 1 new option
New WordPress options
amp_supremacy_stat_id

Browser metrics Passed 4 tests

An overview of browser requirements for AMP Supremacy
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,834 ▲8015.90 ▲0.286.04 ▲0.171.98 ▼0.29
Dashboard /wp-admin2,942 ▲846.20 ▲0.02120.32 ▼19.31183.24 ▲19.59
Posts /wp-admin/edit.php2,727 ▲363.27 ▲0.0568.38 ▲1.14141.46 ▼9.00
Add New Post /wp-admin/post-new.php1,809 ▲14817.38 ▲1.33407.97 ▼36.79176.62 ▲14.51
Media Library /wp-admin/upload.php1,749 ▲515.58 ▲0.06125.70 ▼17.93201.37 ▲19.28

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 1 option
    • amp_supremacy_stat_id

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/amp-supremacy/pages/sections/menu.php
    • > /wp-content/plugins/amp-supremacy/pages/sections/mobile_test.php
    • > /wp-content/plugins/amp-supremacy/pages/sections/design.php
    • > /wp-content/plugins/amp-supremacy/pages/sections/structured_data.php
  • 27× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Undefined variable: AMPLiteLicenseRequested in wp-content/plugins/amp-supremacy/pages/sections/amp_lite.php on line 39
    • > PHP Notice
      Undefined variable: amps in wp-content/plugins/amp-supremacy/pages/sections/design.php on line 43
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/amp-supremacy/pages/sections/design.php on line 31
    • > PHP Notice
      Undefined variable: registration_status in wp-content/plugins/amp-supremacy/pages/sections/amp_lite.php on line 67
    • > PHP Warning
      require_once(AMP_PATH/pages/sections/amp-db-settings.php): failed to open stream: No such file or directory in wp-content/plugins/amp-supremacy/pages/amp_settings.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function site_url() in wp-content/plugins/amp-supremacy/pages/sections/settings.php:13
    • > PHP Notice
      Undefined variable: amps in wp-content/plugins/amp-supremacy/pages/sections/design.php on line 24
    • > PHP Notice
      Undefined variable: AMPLiteLicenseRequested in wp-content/plugins/amp-supremacy/pages/sections/amp_lite.php on line 16
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/amp-supremacy/pages/sections/design.php on line 43
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/amp-supremacy/pages/amps-sample.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
4 plugin tags: design your accelerated mobile pages, accelerated mobile pages, amp validator, amp

amp-supremacy/amp-supremacy.php Passed 13 tests

The main PHP script in "AMP Supremacy" version 2.0.13 is automatically included on every request by WordPress
78 characters long description:
AMP Supremacy | Accelerated Mobile Pages - By the makers of Project Supremacy.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin9,464 lines of code in 117 files:
LanguageFilesBlank linesComment linesLines of code
PHP228013724,644
JavaScript486043682,950
CSS461832411,215
SVG100655

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity92.29
▷ Minimum class complexity24.00
▷ Maximum class complexity197.00
Average method complexity4.97
▷ Minimum method complexity1.00
▷ Maximum method complexity99.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods160
▷ Static methods7446.25%
▷ Public methods14389.38%
▷ Protected methods1610.00%
▷ Private methods10.62%
Functions9
▷ Named functions555.56%
▷ Anonymous functions444.44%
Constants46
▷ Global constants4189.13%
▷ Class constants510.87%
▷ Public constants5100.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
35 compressed PNG files occupy 0.66MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/close-menu.png0.56KB0.58KB0.00%
assets/img/touch/touch-icon-60x60.png2.78KB1.95KB▼ 29.72%
assets/img/menu-icon.png1.41KB1.57KB0.00%
assets/img/logo.png4.60KB3.49KB▼ 24.21%
assets/img/startup/startup-retina.png2.21KB2.37KB0.00%