68% grumft-amp

Code Review | Grumft AMP Plugin

WordPress plugin Grumft AMP Plugin scored68%from 54 tests.

About plugin

  • Plugin page: grumft-amp
  • Plugin version: 5.7
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.7
  • WordPress version: 6.3.1
  • First release: Nov 8, 2019
  • Latest release: Mar 24, 2021
  • Number of updates: 64
  • Update frequency: every 8.1 days
  • Top authors: brunobonanho (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /920 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.22MB] [CPU: ▼3.19ms] Passed 4 tests

Server-side resources used by Grumft AMP Plugin
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.2246.11 ▼0.67
Dashboard /wp-admin3.52 ▲0.2250.40 ▼2.97
Posts /wp-admin/edit.php3.64 ▲0.2853.18 ▲2.31
Add New Post /wp-admin/post-new.php6.10 ▲0.2298.34 ▼10.87
Media Library /wp-admin/upload.php3.44 ▲0.2138.49 ▲1.77

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 155 new files
Database: 3 new tables, 6 new options
New tables
grumft_amp_configs
grumft_amp_style_settings
grumft_amp_adtags
New WordPress options
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_recent-comments
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

Grumft AMP Plugin: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲4314.17 ▼0.241.62 ▼0.1640.34 ▼7.31
Dashboard /wp-admin2,198 ▲215.77 ▲0.1993.13 ▼10.3376.54 ▲32.08
Posts /wp-admin/edit.php2,118 ▲181.97 ▼0.0938.98 ▲3.3933.18 ▼0.95
Add New Post /wp-admin/post-new.php1,539 ▲423.75 ▲5.45667.23 ▲19.2561.97 ▼9.52
Media Library /wp-admin/upload.php1,418 ▲184.11 ▼0.08111.63 ▲15.4366.01 ▲25.35

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie tables detected upon uninstall: 3 tables
    • grumft_amp_adtags
    • grumft_amp_style_settings
    • grumft_amp_configs
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 4× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/grumft-amp/templates/simple_blog/footer.php
    • > /wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/masterminds/html5/bin/entities.php
    • > /wp-content/plugins/grumft-amp/templates/simple_blog/css/home.css.php
    • > /wp-content/plugins/grumft-amp/vendor/disqus/disqus-amp.php
  • 66× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Masterminds\\HTML5\\Tests\\TestCase' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'FastImageSize\\Type\\TypeBase' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/marc1706/fast-image-size/lib/Type/TypeIff.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/grumft-amp/templates/simple_blog/head_end.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'magyarandras\\AMPConverter\\TagConverterInterface' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/magyarandras/amp-converter/src/TagConverter/AMPImgZoom.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Masterminds\\HTML5\\Tests\\TestCase' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/masterminds/html5/test/HTML5/ElementsTest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Masterminds\\HTML5\\Tests\\TestCase' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'Masterminds\\HTML5\\Parser\\EventHandler' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php:26
    • > PHP Notice
      Undefined variable: blog_name in wp-content/plugins/grumft-amp/templates/simple_blog/footer.php on line 11
    • > PHP Fatal error
      Uncaught Error: Interface 'magyarandras\\AMPConverter\\TagConverterInterface' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/magyarandras/amp-converter/src/TagConverter/AMPGist.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Masterminds\\HTML5\\Tests\\TestCase' not found in wp-content/plugins/grumft-amp/vendor/amp-converter-master/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Contributors: Plugin contributors not specified
You can take inspiration from this readme.txt

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

"Grumft AMP Plugin" version 5.7's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin21,380 lines of code in 131 files:
LanguageFilesBlank linesComment linesLines of code
PHP982,4543,33513,623
HTML41,089565,286
JavaScript13291611,365
Markdown72020504
JSON500294
SVG1155200
YAML48091
XML10017

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity11.27
▷ Minimum class complexity1.00
▷ Maximum class complexity140.00
Average method complexity2.54
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces14
Interfaces6
Traits0
Classes69
▷ Abstract classes11.45%
▷ Concrete classes6898.55%
▷ Final classes00.00%
Methods531
▷ Static methods285.27%
▷ Public methods43982.67%
▷ Protected methods8115.25%
▷ Private methods112.07%
Functions9
▷ Named functions666.67%
▷ Anonymous functions333.33%
Constants116
▷ Global constants10.86%
▷ Class constants11599.14%
▷ Public constants115100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
7 compressed PNG files occupy 0.33MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
templates/simple_blog/img/blog/logo.png9.18KB9.46KB0.00%
assets/images/amp-icon-menu-wp.png0.60KB0.69KB0.00%
templates/simple_blog/img/blog/popular2.png120.27KB131.52KB0.00%
templates/simple_blog/img/blog/want2.png80.43KB86.73KB0.00%
templates/simple_blog/img/blog/want1.png70.80KB78.13KB0.00%