84% random-post-ajax

Code Review | Random Post with ajax

WordPress plugin Random Post with ajax scored84%from 54 tests.

About plugin

  • Plugin page: random-post-ajax
  • Plugin version: 0.8.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.1-5.3
  • WordPress version: 6.3.1
  • First release: Apr 2, 2016
  • Latest release: Mar 28, 2020
  • Number of updates: 91
  • Update frequency: every 16.0 days
  • Top authors: born88 (57.14%)misaco (40.66%)sadegh3333 (4.4%)

Code review

54 tests

User reviews

2 reviews

Install metrics

40+ active /5,019 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: ▼6.63ms] Passed 4 tests

This is a short check of server-side resources used by Random Post with ajax
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0237.30 ▼2.64
Dashboard /wp-admin3.32 ▼0.0244.29 ▼19.42
Posts /wp-admin/edit.php3.37 ▲0.0247.66 ▲3.85
Add New Post /wp-admin/post-new.php5.90 ▲0.0291.41 ▼0.40
Media Library /wp-admin/upload.php3.25 ▲0.0232.84 ▼4.04

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 12 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Random Post with ajax
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,926 ▲18013.59 ▼0.615.52 ▲3.9639.97 ▲0.22
Dashboard /wp-admin2,224 ▲365.88 ▲0.8796.80 ▼17.4088.28 ▲42.80
Posts /wp-admin/edit.php2,110 ▲211.99 ▼0.0441.32 ▲5.6034.08 ▼0.59
Add New Post /wp-admin/post-new.php1,542 ▲2018.18 ▼4.98646.65 ▼31.5073.59 ▲23.31
Media Library /wp-admin/upload.php1,403 ▲124.11 ▼0.1097.29 ▼4.6669.28 ▲23.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
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/random-post-ajax/random-post-class.php:16

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, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention: The official readme.txt is a good inspiration

random-post-ajax/random-post.php 92% from 13 tests

The principal PHP file in "Random Post with ajax" v. 0.8.1 is loaded by WordPress automatically on each request
The following require your attention:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("random-post-ajax.php" instead of "random-post.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin804 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP612046431
CSS16617341
JavaScript112432

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity4.00
▷ Minimum class complexity1.00
▷ Maximum class complexity10.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods9
▷ Static methods00.00%
▷ Public methods9100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
inc/img/icon.png3.60KB1.29KB▼ 64.14%