84% random-post-shortcode

Code Review | Random Post Shortcode

WordPress plugin Random Post Shortcode scored84%from 54 tests.

About plugin

  • Plugin page: random-post-short...
  • Plugin version: 1.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.9
  • WordPress version: 6.3.1
  • First release: Jan 16, 2013
  • Latest release: Feb 22, 2022
  • Number of updates: 15
  • Update frequency: every 221.6 days
  • Top authors: PowieT (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

400+ active /9,329 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

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

Analyzing server-side resources used by Random Post Shortcode
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0243.02 ▼5.04
Dashboard /wp-admin3.33 ▼0.0252.89 ▼15.04
Posts /wp-admin/edit.php3.38 ▲0.0248.27 ▼15.57
Add New Post /wp-admin/post-new.php5.91 ▲0.0291.73 ▼15.70
Media Library /wp-admin/upload.php3.26 ▲0.0237.65 ▲3.51

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 3 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
widget_random-post-widget
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Random Post Shortcode
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲5314.38 ▲0.192.07 ▲0.1845.07 ▲2.01
Dashboard /wp-admin2,192 ▲155.57 ▼0.1084.30 ▼20.4440.46 ▼0.93
Posts /wp-admin/edit.php2,100 ▼72.02 ▲0.0234.55 ▼10.7734.07 ▼11.62
Add New Post /wp-admin/post-new.php1,526 ▼2317.44 ▼5.53713.22 ▲102.0653.75 ▼0.95
Media Library /wp-admin/upload.php1,400 ▼04.25 ▲0.05107.10 ▲1.4046.38 ▲1.67

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_random-post-widget
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/random-post-shortcode/random-post-widget.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/random-post-shortcode/random-post-widget.php:6

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

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
4 plugin tags: shortcode, post, random, widget

random-post-shortcode/random-post-shortcode.php Passed 13 tests

The main PHP script in "Random Post Shortcode" version 1.0.5 is automatically included on every request by WordPress
71 characters long description:
Shortcode [random-post] for displaying a random post, or use the Widget

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin91 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP2163791

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.15
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.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
No PNG images were found in this plugin