84% random-posts-from-category

Code Review | Random Posts from Category

WordPress plugin Random Posts from Category scored84%from 54 tests.

About plugin

  • Plugin page: random-posts-from...
  • Plugin version: 1.30
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-4.5
  • WordPress version: 6.3.1
  • First release: Aug 6, 2009
  • Latest release: Apr 23, 2016
  • Number of updates: 21
  • Update frequency: every 116.8 days
  • Top authors: sillybean (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

300+ active /17,848 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.04MB] [CPU: ▼6.06ms] Passed 4 tests

An overview of server-side resources used by Random Posts from Category
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0436.35 ▼2.88
Dashboard /wp-admin3.35 ▲0.0443.09 ▼5.05
Posts /wp-admin/edit.php3.40 ▲0.0448.58 ▲0.87
Add New Post /wp-admin/post-new.php5.93 ▲0.0487.85 ▼13.27
Media Library /wp-admin/upload.php3.27 ▲0.0432.49 ▼3.05

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 9 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
db_upgraded
widget_randompostsfromcategory
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Random Posts from Category: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.30 ▼0.991.59 ▼0.2938.69 ▼7.76
Dashboard /wp-admin2,206 ▲174.82 ▼0.09107.73 ▼12.8139.88 ▼5.69
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.0239.41 ▲2.5234.81 ▲1.90
Add New Post /wp-admin/post-new.php1,544 ▲1618.40 ▲0.37584.72 ▼27.3655.95 ▲2.99
Media Library /wp-admin/upload.php1,388 ▲34.21 ▼0.0096.23 ▲0.9640.99 ▼1.23

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
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_recent-posts
    • widget_randompostsfromcategory
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting 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 take a closer look at the following
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/random-posts-from-category/random-from-category-widget.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
3 plugin tags: widget, posts, random

random-posts-from-category/random-from-category-widget.php 92% from 13 tests

Analyzing the main PHP file in "Random Posts from Category" version 1.30
You should first fix the following items:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("random-posts-from-category.php" instead of "random-from-category-widget.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected204 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP12213116
PO File2323787
Markdown1001

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity15.00
▷ Minimum class complexity15.00
▷ Maximum class complexity15.00
Average method complexity4.50
▷ Minimum method complexity1.00
▷ Maximum method complexity13.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%
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

PNG files should be compressed to save space and minimize bandwidth usage
No PNG images were found in this plugin