84% ays-random-posts-and-pages

Code Review | Random Posts and Pages Widget

WordPress plugin Random Posts and Pages Widget scored84%from 54 tests.

About plugin

  • Plugin page: ays-random-posts-...
  • Plugin version: 2.5.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.3
  • WordPress version: 6.3.1
  • First release: May 14, 2015
  • Latest release: Aug 14, 2023
  • Number of updates: 134
  • Update frequency: every 22.8 days
  • Top authors: ays-pro (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

500+ active /20,012 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.25MB] [CPU: ▼12.32ms] Passed 4 tests

This is a short check of server-side resources used by Random Posts and Pages Widget
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.69 ▲0.2335.33 ▼5.33
Dashboard /wp-admin3.57 ▲0.2243.38 ▼18.16
Posts /wp-admin/edit.php3.61 ▲0.2549.16 ▲1.21
Add New Post /wp-admin/post-new.php6.25 ▲0.3680.46 ▼22.45
Media Library /wp-admin/upload.php3.51 ▲0.2829.92 ▼3.33

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Random Posts and Pages Widget
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.24 ▼1.131.66 ▼0.3340.14 ▼15.64
Dashboard /wp-admin2,206 ▲185.91 ▲0.03112.61 ▼3.2136.16 ▼9.22
Posts /wp-admin/edit.php2,089 ▼02.00 ▼0.0539.27 ▲2.1134.34 ▲0.30
Add New Post /wp-admin/post-new.php1,514 ▼2817.75 ▼0.17684.88 ▲60.1265.38 ▲3.71
Media Library /wp-admin/upload.php1,388 ▼34.16 ▼0.0696.87 ▼4.6742.21 ▼2.72

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 7 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_random_posts_and_pages
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/ays-random-posts-and-pages/WordPress_Random_Posts_and_Pages.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: related posts, random posts, random post, random pages, popular posts

ays-random-posts-and-pages/WordPress_Random_Posts_and_Pages.php 92% from 13 tests

The main PHP file in "Random Posts and Pages Widget" ver. 2.5.7 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("ays-random-posts-and-pages.php" instead of "WordPress_Random_Posts_and_Pages.php")

Code Analysis 97% from 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
No dangerous file extensions were detected4,882 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
CSS2564113,117
PHP19350956
JavaScript313745799
HTML23010

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please tend to the following items
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 105)
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity216.00
▷ Minimum class complexity216.00
▷ Maximum class complexity216.00
Average method complexity54.75
▷ Minimum method complexity1.00
▷ Maximum method complexity105.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%
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
4 compressed PNG files occupy 0.01MB
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
jscolor/hv.png2.80KB7.32KB0.00%
jscolor/hs.png2.62KB7.54KB0.00%
images/wrong.png0.52KB0.53KB0.00%
images/gallery_img.png2.62KB2.01KB▼ 23.31%