84% random-post-on-refresh

Code Review | Random Post on Refresh

WordPress plugin Random Post on Refresh scored84%from 54 tests.

About plugin

  • Plugin page: random-post-on-re...
  • Plugin version: 1.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.7
  • WordPress version: 6.3.1
  • First release: Mar 30, 2018
  • Latest release: Apr 29, 2021
  • Number of updates: 9
  • Update frequency: every 125.1 days
  • Top authors: wpscholar (55.56%)woodent (55.56%)

Code review

54 tests

User reviews

5 reviews

Install metrics

400+ active /4,544 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
Installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼6.51ms] Passed 4 tests

Server-side resources used by Random Post on Refresh
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0439.11 ▲5.06
Dashboard /wp-admin3.35 ▼0.0044.48 ▼18.64
Posts /wp-admin/edit.php3.40 ▲0.0449.00 ▲7.23
Add New Post /wp-admin/post-new.php5.93 ▲0.0482.19 ▼13.50
Media Library /wp-admin/upload.php3.27 ▲0.0433.96 ▲1.05

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Random Post on Refresh
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.28 ▲0.291.79 ▲0.0143.93 ▲1.22
Dashboard /wp-admin2,192 ▲145.55 ▼0.1682.33 ▼32.3738.26 ▼4.67
Posts /wp-admin/edit.php2,100 ▼02.03 ▲0.0638.73 ▼0.3934.82 ▲2.54
Add New Post /wp-admin/post-new.php1,526 ▼1123.26 ▲4.76667.79 ▼0.6371.29 ▼5.86
Media Library /wp-admin/upload.php1,400 ▲34.17 ▼0.0895.15 ▼7.4340.08 ▼1.74

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts

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
Everything seems fine, however this is by no means an exhaustive test

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 items
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/random-post-on-refresh/RandomPostOnRefresh.php:29

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 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
3 plugin tags: random post, different post, post rotation

random-post-on-refresh/RandomPostOnRefresh.php 92% from 13 tests

The main file in "Random Post on Refresh" v. 1.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("random-post-on-refresh.php" instead of "RandomPostOnRefresh.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin259 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP14872213
CSS18246

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.72
Average class complexity44.00
▷ Minimum class complexity44.00
▷ Maximum class complexity44.00
Average method complexity1.50
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods7
▷ Static methods7100.00%
▷ Public methods7100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG files were detected