68% simple-amp

Code Review | Simple AMP

WordPress plugin Simple AMP scored68%from 54 tests.

About plugin

  • Plugin page: simple-amp
  • Plugin version: 0.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-4.6.1
  • WordPress version: 6.3.1
  • First release: Oct 23, 2016
  • Latest release: Oct 25, 2016
  • Number of updates: 11
  • Update frequency: every 0.4 days
  • Top authors: m_uysl (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /991 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼2.09ms] Passed 4 tests

This is a short check of server-side resources used by Simple AMP
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0238.66 ▲0.21
Dashboard /wp-admin3.32 ▲0.0148.19 ▲0.44
Posts /wp-admin/edit.php3.37 ▲0.0249.67 ▲0.90
Add New Post /wp-admin/post-new.php5.90 ▲0.0187.13 ▼9.91
Media Library /wp-admin/upload.php3.24 ▲0.0138.41 ▲1.82

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 612 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

Simple AMP: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲5514.48 ▼0.271.71 ▼0.1644.79 ▲4.90
Dashboard /wp-admin2,206 ▲154.88 ▼0.24109.39 ▲3.3241.42 ▼0.79
Posts /wp-admin/edit.php2,089 ▼32.03 ▲0.0440.17 ▼1.3134.99 ▼1.18
Add New Post /wp-admin/post-new.php1,536 ▲222.99 ▼0.15632.14 ▼63.8149.46 ▼9.37
Media Library /wp-admin/upload.php1,388 ▲34.15 ▼0.1497.43 ▼5.1748.93 ▲2.35

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

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
Good news, no errors were detected

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
  • 6× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/simple-amp/vendor/masterminds/html5/bin/entities.php
    • > /wp-content/plugins/simple-amp/vendor/querypath/querypath/phar/basic_loader.php
    • > /wp-content/plugins/simple-amp/vendor/querypath/querypath/examples/at_a_glance.php
    • > /wp-content/plugins/simple-amp/vendor/sabberworm/php-css-parser/tests/quickdump.php
    • > /wp-content/plugins/simple-amp/vendor/querypath/querypath/bin/compactor.php
    • > /wp-content/plugins/simple-amp/vendor/querypath/querypath/examples/html.php
  • 249× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/simple-amp/vendor/guzzlehttp/psr7/tests/StreamWrapperTest.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/simple-amp/vendor/guzzlehttp/psr7/src/DroppingStream.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/simple-amp/vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/DocumentTest.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Exception\\GuzzleException' not found in wp-content/plugins/simple-amp/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Masterminds\\HTML5' not found in wp-content/plugins/simple-amp/vendor/lullabot/amp/src/Utility/AMPHTML5.php:36
    • > PHP Fatal error
      require_once(): Failed opening required '../src/QueryPath/QueryPath.php' (include_path='.:/usr/share/php') in wp-content/plugins/simple-amp/vendor/querypath/querypath/examples/dbpedia.php on line 28
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/simple-amp/vendor/guzzlehttp/psr7/src/NoSeekStream.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Sabberworm\\CSS\\Property\\AtRule' not found in wp-content/plugins/simple-amp/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/CSSNamespace.php:8
    • > PHP Warning
      require(wp-content/plugins/simple-amp/vendor/guzzlehttp/psr7/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/simple-amp/vendor/guzzlehttp/psr7/tests/bootstrap.php on line 4
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Cookie\\CookieJarInterface' not found in wp-content/plugins/simple-amp/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
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: google, mobile, amp, accelerated mobile pages

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

The main PHP file in "Simple AMP" ver. 0.1.1 adds more information about the plugin and also serves as the entry point for this plugin
67 characters long description:
A simple plugin that generates AMP pages based on current template.

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Almost there! Just fix the following issues
  • Do not include executable or dangerous files in your plugin
    • .out - Executable in Linux
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/amp_layouts.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/aria.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/audio-to-amp-audio-conversion-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/bad_viewport.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/blacklisted_tags.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/dailymotion-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/diff_test.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/duplicate_unique_tags_and_wrong_parents.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/empty.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/facebook-iframe-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/facebook-non-iframe-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/iframe-http-to-https-conversion.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/img-test-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/incorrect_custom_style.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/incorrect_mandatory_style.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/instagram-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/javascript_xss.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/link_meta_values.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/mandatory_dimensions.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/minimum_valid_amp.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/new_and_old_boilerplate_mixed.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/new_and_old_boilerplate_mixed2.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/no_custom_js.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/no_important.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/noscript.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/old-boilerplate.amp.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/pinterest-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/regexps.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/sample-html-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/several_errors.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/show_lines_no_orig_and_warn.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/soundcloud-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/spec_example.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/svg.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/template_test.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/template_test_with_statistics.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/track_tag.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/twitter-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/urls.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-accordion.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-carousel.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-facebook.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-jwplayer.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-mustache.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-pinterest.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-sidebar.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-soundcloud.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-springboard-player.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-vimeo.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/validator-amp-youtube.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/video-fragment-and-placeholder-test.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/full-html/video-to-amp-video-conversion.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/vimeo-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/vine-fragment.html.out
      • wp-content/plugins/simple-amp/vendor/lullabot/amp/tests/test-data/fragment-html/youtube-fragment.html.out
64,997 lines of code in 523 files:
LanguageFilesBlank linesComment linesLines of code
PHP3467,06517,17746,853
XML2540610,395
Markdown241,31104,500
HTML592187871,437
JSON1800888
Ant289133394
CSS304316264
YAML8314162
make320151
Bourne Shell510844
INI2005
SVG1004

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please tend to the following items
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 116)
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity13.04
▷ Minimum class complexity1.00
▷ Maximum class complexity381.00
Average method complexity2.54
▷ Minimum method complexity1.00
▷ Maximum method complexity116.00
Code structure
Namespaces42
Interfaces26
Traits2
Classes315
▷ Abstract classes82.54%
▷ Concrete classes30797.46%
▷ Final classes72.28%
Methods2,848
▷ Static methods1294.53%
▷ Public methods2,46686.59%
▷ Protected methods2077.27%
▷ Private methods1756.14%
Functions381
▷ Named functions6617.32%
▷ Anonymous functions31582.68%
Constants395
▷ Global constants112.78%
▷ Class constants38497.22%
▷ Public constants384100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There are no PNG files in this plugin