84% random-and-popular-post

Code Review | Random AND Popular Post

WordPress plugin Random AND Popular Post scored84%from 54 tests.

About plugin

  • Plugin page: random-and-popula...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.4.2
  • WordPress version: 6.3.1
  • First release: Jul 21, 2020
  • Latest release: Jul 25, 2020
  • Number of updates: 10
  • Update frequency: every 0.5 days
  • Top authors: themorshed (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /392 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.05MB] [CPU: ▼8.73ms] Passed 4 tests

An overview of server-side resources used by Random AND Popular Post
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0640.77 ▼1.20
Dashboard /wp-admin3.36 ▲0.0252.22 ▼20.57
Posts /wp-admin/edit.php3.48 ▲0.1250.78 ▼2.74
Add New Post /wp-admin/post-new.php5.95 ▲0.0694.16 ▼10.41
Media Library /wp-admin/upload.php3.29 ▲0.0639.25 ▲0.26

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
widget_random-and-popular-post-widget
widget_recent-posts
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Random AND Popular Post
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲5514.62 ▲0.692.00 ▲0.3442.55 ▼0.63
Dashboard /wp-admin2,198 ▲215.62 ▲0.0185.15 ▼20.0636.69 ▼7.49
Posts /wp-admin/edit.php2,100 ▼01.99 ▲0.0435.09 ▼4.7734.37 ▼4.30
Add New Post /wp-admin/post-new.php1,526 ▼023.28 ▲0.13683.74 ▼19.6962.20 ▲2.95
Media Library /wp-admin/upload.php1,403 ▲34.19 ▲0.0198.66 ▼16.7945.35 ▼4.16

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
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_random-and-popular-post-widget
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget

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
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/random-and-popular-post/includes/class-widget-random-and-popular-post.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

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 require attention:
  • Donate link: Please fix this invalid url: ""
You can take inspiration from this readme.txt

random-and-popular-post/random-and-popular-post.php Passed 13 tests

The main PHP script in "Random AND Popular Post" version 1.0.0 is automatically included on every request by WordPress
94 characters long description:
This is WordPress Lightweight Plugin for display Random Posts, Popular Posts and Recent posts.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin215 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP892388206
CSS1049

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity4.00
▷ Minimum class complexity1.00
▷ Maximum class complexity13.00
Average method complexity1.75
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods20
▷ Static methods00.00%
▷ Public methods1680.00%
▷ Protected methods00.00%
▷ Private methods420.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
public/img/thumbnail.png1.74KB0.41KB▼ 76.56%