88% instant-articles

Code Review | WordPress Instant Articles

WordPress plugin WordPress Instant Articles scored 88% from 54 tests.

About plugin

  • Plugin page: instant-articles
  • Plugin version: 1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.6
  • WordPress version: 5.8.1
  • First release: Jun 20, 2015
  • Latest release: Jul 29, 2016
  • Number of updates: 18
  • Update frequency: every 23.3 days
  • Top authors: khromov (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

400+ active / 11,945 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.02MB] [CPU: ▼160.28ms] Passed 4 tests

A check of server-side resources used by WordPress Instant Articles
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.86 ▲0.0223.22 ▼0.08
Dashboard /wp-admin3.09 ▲0.0236.04 ▲1.86
Posts /wp-admin/edit.php3.14 ▲0.0333.25 ▲3.96
Add New Post /wp-admin/post-new.php5.45 ▲0.0167.55 ▼638.26
Media Library /wp-admin/upload.php3.03 ▲0.0323.82 ▼4.62

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 332 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

WordPress Instant Articles: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,714 ▲10315.96 ▲0.726.26 ▼2.3276.39 ▼4.53
Dashboard /wp-admin2,976 ▲806.07 ▼0.07118.45 ▼13.81188.49 ▲13.79
Posts /wp-admin/edit.php2,788 ▲512.93 ▼0.3162.00 ▼1.77135.00 ▼7.49
Add New Post /wp-admin/post-new.php3,972 ▲16521.24 ▲2.06436.21 ▼19.31198.87 ▲18.06
Media Library /wp-admin/upload.php1,802 ▲505.74 ▲0.18124.49 ▼19.58205.66 ▲25.13

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for 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 applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 5× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/instant-articles/partials/admin-global-css.php
    • > /wp-content/plugins/instant-articles/partials/admin-help-tab-overview.php
    • > /wp-content/plugins/instant-articles/partials/admin-help-tab-prerender.php
    • > /wp-content/plugins/instant-articles/partials/admin-help-tab-dnsprefetch.php
    • > /wp-content/plugins/instant-articles/partials/admin-css.php
  • 14× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/instant-articles/libraries/cmb2/bootstrap.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/instant-articles/libraries/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/instant-articles/libraries/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/instant-articles/libraries/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/instant-articles/libraries/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      require_once(): Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/instant-articles/libraries/cmb2/tests/bootstrap.php on line 24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/instant-articles/libraries/cmb2/example-functions.php:68
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/instant-articles/libraries/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/instant-articles/libraries/cmb2/init.php:119
    • > PHP Warning
      require_once(/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/instant-articles/libraries/cmb2/tests/bootstrap.php on line 24

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
You can take inspiration from this readme.txt

instant-articles/instant-articles.php Passed 13 tests

The primary PHP file in "WordPress Instant Articles" version 1.4 is used by WordPress to initiate all plugin functionality
71 characters long description:
Increase your site performance with DNS prefetching and HTML5 prerender

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
Good job! No executable or dangerous file extensions detected88,244 lines of code in 185 files:
LanguageFilesBlank linesComment linesLines of code
XML20047,741
PO File11912,61416,20928,917
PHP341,4212,4224,944
CSS41,0081,0223,888
Sass11168231,116
JavaScript4186174825
Markdown41640458
YAML290152
JSON300121
Bourne Shell119771
SVG10111

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity20.57
▷ Minimum class complexity1.00
▷ Maximum class complexity113.00
Average method complexity2.68
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes30
▷ Abstract classes13.33%
▷ Concrete classes2996.67%
▷ Final classes00.00%
Methods350
▷ Static methods298.29%
▷ Public methods33696.00%
▷ Protected methods92.57%
▷ Private methods51.43%
Functions27
▷ Named functions27100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants350.00%
▷ Class constants350.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
14 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
libraries/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
libraries/cmb2/images/ui-bg_flat_75_ffffff_40x100.png0.17KB0.08KB▼ 51.12%
libraries/cmb2/images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%
libraries/cmb2/images/ui-icons_454545_256x240.png4.27KB4.11KB▼ 3.78%
libraries/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%