84% vi-random-posts-widget

Code Review | Vi Random Post Widget

WordPress plugin Vi Random Post Widget scored84%from 54 tests.

About plugin

  • Plugin page: vi-random-posts-w...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.2.1
  • WordPress version: 6.3.1
  • First release: Jan 23, 2015
  • Latest release: Jun 18, 2019
  • Number of updates: 14
  • Update frequency: every 114.8 days
  • Top authors: vivacityinfotech.jaipur (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

200+ active /5,409 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.07MB] [CPU: ▼7.07ms] Passed 4 tests

Server-side resources used by Vi Random Post Widget
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0942.08 ▼5.05
Dashboard /wp-admin3.39 ▲0.0457.46 ▼11.78
Posts /wp-admin/edit.php3.51 ▲0.1557.96 ▲9.28
Add New Post /wp-admin/post-new.php5.98 ▲0.0889.87 ▼11.30
Media Library /wp-admin/upload.php3.32 ▲0.0838.81 ▼0.13

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 19 new files
Database: no new tables, 7 new options
New WordPress options
widget_virp-widget
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Vi Random Post Widget
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲4714.33 ▲0.191.80 ▲0.1043.85 ▼1.15
Dashboard /wp-admin2,198 ▲245.60 ▲0.0787.14 ▼14.1742.74 ▲0.69
Posts /wp-admin/edit.php2,100 ▼02.03 ▲0.0635.55 ▲0.1932.14 ▼4.17
Add New Post /wp-admin/post-new.php1,526 ▼023.46 ▲0.39696.95 ▼13.4851.36 ▼8.62
Media Library /wp-admin/upload.php1,394 ▼94.20 ▼0.1299.09 ▼6.7444.54 ▼4.53

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_virp-widget
    • can_compress_scripts

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 | 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
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/vi-random-posts-widget/includes/form.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/vi-random-posts-widget/includes/shortcode.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/vi-random-posts-widget/includes/widget.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
7 plugin tags: custom post widget, post widget, random post widget, latest post widget, random post...

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

The primary PHP file in "Vi Random Post Widget" version 1.1 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("vi-random-posts-widget.php" instead of "virp.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin2,782 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
CSS42121,696
PHP6156135566
SVG100520

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity16.00
▷ Minimum class complexity4.00
▷ Maximum class complexity31.00
Average method complexity3.81
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods16
▷ Static methods16.25%
▷ Public methods1487.50%
▷ Protected methods00.00%
▷ Private methods212.50%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.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 files were detected