84% xkcd-shortcode

Code Review | xkcd-shortcode

WordPress plugin xkcd-shortcode scored84%from 54 tests.

About plugin

  • Plugin page: xkcd-shortcode
  • Plugin version: 0.8.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5.0-3.8.1
  • WordPress version: 6.3.1
  • First release: Feb 19, 2014
  • Latest release: Mar 17, 2014
  • Number of updates: 6
  • Update frequency: every 4.5 days
  • Top authors: dsawardekar (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /759 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.02MB] [CPU: ▼5.11ms] Passed 4 tests

An overview of server-side resources used by xkcd-shortcode
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0239.59 ▲2.07
Dashboard /wp-admin3.32 ▲0.0245.76 ▼2.96
Posts /wp-admin/edit.php3.44 ▲0.0841.24 ▼7.01
Add New Post /wp-admin/post-new.php5.90 ▲0.0278.96 ▼10.97
Media Library /wp-admin/upload.php3.25 ▲0.0233.25 ▲0.49

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 18 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
db_upgraded
widget_recent-posts
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for xkcd-shortcode
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.74 ▲0.431.87 ▲0.2043.31 ▲2.98
Dashboard /wp-admin2,206 ▲184.87 ▼0.16111.39 ▲9.6341.60 ▼1.75
Posts /wp-admin/edit.php2,071 ▼212.03 ▲0.0334.84 ▼11.4040.91 ▼10.76
Add New Post /wp-admin/post-new.php1,514 ▼017.56 ▼0.24661.99 ▼9.2650.55 ▼0.16
Media Library /wp-admin/upload.php1,382 ▼34.20 ▼0.1196.04 ▼8.5844.60 ▼0.29

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 75% 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 50% 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
The following issues need your attention
  • 7× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/xkcd-shortcode/tests/XKCDLoaderTest.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/xkcd-shortcode/lib/XKCDShortcodePlugin.php:9
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/xkcd-shortcode/tests/bootstrap.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/xkcd-shortcode/tests/XKCDShortcodeTest.php:5
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/xkcd-shortcode/tests/bootstrap.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/xkcd-shortcode/tests/XKCDShortcodePluginTest.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/xkcd-shortcode/tests/CachedXKCDLoaderTest.php:6

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: Add an image for screenshot #1 (The XKCD Webcomic #1 embedded in a Post.)
You can take inspiration from this readme.txt

xkcd-shortcode/xkcd-shortcode.php Passed 13 tests

The entry point to "xkcd-shortcode" version 0.8.0 is a PHP file that has certain tags in its header comment area
64 characters long description:
Adds an [xkcd] shortcode that loads the XKCD webcomic by number.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin460 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP1011811372
Bourne Shell115459
JSON20015
XML10014

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.07
Average class complexity2.38
▷ Minimum class complexity1.00
▷ Maximum class complexity6.00
Average method complexity1.19
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods59
▷ Static methods00.00%
▷ Public methods59100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
1 PNG file occupies 0.11MB with 0.05MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png112.58KB56.80KB▼ 49.54%