10% show-a-random-post-widget

Code Review | Show a Random Post Widget

WordPress plugin Show a Random Post Widget scored 10% from 54 tests.

About plugin

  • Plugin page: show-a-random-pos...
  • Plugin version: 2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.9.4
  • WordPress version: 6.3.1
  • First release: Mar 6, 2018
  • Latest release: Mar 6, 2018
  • Number of updates: 4
  • Update frequency: N/A
  • Top authors: DionRodrigues (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 550 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Please fix the following installer errors
  • This plugin did not install gracefully
    • > Deprecated in wp-content/plugins/show-a-random-post-widget/show-random-post-widget.php+92
    Function create_function() is deprecated

Server metrics [RAM: ▼1.96MB] [CPU: ▼52.55ms] Passed 4 tests

This is a short check of server-side resources used by Show a Random Post Widget
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.03 ▼1.433.76 ▼40.08
Dashboard /wp-admin2.05 ▼1.266.16 ▼42.95
Posts /wp-admin/edit.php2.05 ▼1.315.72 ▼39.46
Add New Post /wp-admin/post-new.php2.05 ▼3.845.07 ▼87.71
Media Library /wp-admin/upload.php2.05 ▼1.185.56 ▼28.34

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Show a Random Post Widget
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.24 ▼1.141.78 ▼0.4641.84 ▼5.33
Dashboard /wp-admin2,203 ▲124.85 ▼0.06109.04 ▲0.9940.19 ▼5.41
Posts /wp-admin/edit.php2,092 ▲32.02 ▼0.1039.33 ▲4.3934.71 ▼3.13
Add New Post /wp-admin/post-new.php1,514 ▼2817.82 ▼0.56659.65 ▲12.9752.55 ▼6.23
Media Library /wp-admin/upload.php1,391 ▲94.29 ▲0.08102.79 ▲2.0143.12 ▲0.14

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/show-a-random-post-widget/show-random-post-widget.php+92
    Function create_function() is deprecated
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • widget_dionrodrigues_srptw
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded

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
Almost there! Just fix the following items
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/show-a-random-post-widget/show-random-post-widget.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 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
These attributes need to be fixed:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === show-a-random-post-widget === )
  • Screenshots: Add an image for screenshot #1 (The Show a Random Post Widget option pane.)
The official readme.txt might help

show-a-random-post-widget/show-random-post-widget.php 85% from 13 tests

This is the main PHP file of "Show a Random Post Widget" version 2.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 181 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("show-a-random-post-widget.php" instead of "show-random-post-widget.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected61 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1131961

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.12
Average class complexity6.00
▷ Minimum class complexity6.00
▷ Maximum class complexity6.00
Average method complexity2.25
▷ 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%
Functions0
▷ Named functions00.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
2 PNG files occupy 0.07MB with 0.04MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/screenshot.png72.57KB20.77KB▼ 71.38%
images/icon.png1.55KB0.96KB▼ 38.08%