84% displayrandompost

Code Review | DisplayRandomPost

WordPress plugin DisplayRandomPost scored84%from 54 tests.

About plugin

  • Plugin page: displayrandompost
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-3.4
  • WordPress version: 6.3.1
  • First release: Dec 29, 2012
  • Latest release: Dec 29, 2012
  • Number of updates: 2
  • Update frequency: every 0.5 days
  • Top authors: abbas.s786 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /753 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼2.05ms] Passed 4 tests

An overview of server-side resources used by DisplayRandomPost
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0140.70 ▲4.06
Dashboard /wp-admin3.35 ▲0.0147.29 ▼6.91
Posts /wp-admin/edit.php3.40 ▲0.0149.18 ▼2.85
Add New Post /wp-admin/post-new.php5.93 ▲0.0192.13 ▲3.89
Media Library /wp-admin/upload.php3.27 ▲0.0134.49 ▼2.32

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: no files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

DisplayRandomPost: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7913.17 ▼1.211.90 ▲0.2847.10 ▲2.83
Dashboard /wp-admin2,206 ▲155.90 ▲1.03105.25 ▼3.2341.58 ▲2.33
Posts /wp-admin/edit.php2,089 ▼02.01 ▼0.0438.18 ▲4.2933.86 ▼2.22
Add New Post /wp-admin/post-new.php1,533 ▼923.00 ▲4.56647.73 ▲27.6259.82 ▼17.80
Media Library /wp-admin/upload.php1,388 ▼34.17 ▼0.0192.20 ▼6.5941.77 ▼1.53

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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
The following issues need your attention
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/displayrandompost/template/randompost-template.php:3
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_URL - assumed 'WP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/displayrandompost/displayrandompost.php on line 20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/displayrandompost/displayrandompost.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% 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:
  • Screenshots: Screenshot #1 (No Screeshots as yet :() image required
The official readme.txt is a good inspiration

displayrandompost/displayrandompost.php Passed 13 tests

The entry point to "DisplayRandomPost" version 1.0 is a PHP file that has certain tags in its header comment area
50 characters long description:
This Plugin displays random post from your website

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
No dangerous file extensions were detected69 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP224869

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods00.00%
▷ Public methods3100.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

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin