78% lab404-related-posts

Code Review | Lab404 Related Posts

WordPress plugin Lab404 Related Posts scored78%from 54 tests.

About plugin

  • Plugin page: lab404-related-posts
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.2
  • WordPress version: 6.3.1
  • First release: May 2, 2015
  • Latest release: May 11, 2015
  • Number of updates: 7
  • Update frequency: every 1.3 days
  • Top authors: ivan.m89 (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

20+ active /2,229 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
Installer ran successfully

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

A check of server-side resources used by Lab404 Related Posts
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0437.89 ▼3.40
Dashboard /wp-admin3.35 ▲0.0447.84 ▼3.65
Posts /wp-admin/edit.php3.40 ▲0.0448.44 ▼2.72
Add New Post /wp-admin/post-new.php5.93 ▲0.0486.07 ▼15.18
Media Library /wp-admin/upload.php3.27 ▲0.0438.47 ▼0.61

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 12 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
lab404_related_posts_options
widget_recent-comments
theysaidso_admin_options
widget_recent-posts
lab404_related_posts_version
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Lab404 Related Posts
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,811 ▲5014.17 ▼0.201.64 ▼0.0541.79 ▲0.54
Dashboard /wp-admin2,218 ▲445.57 ▼0.0286.73 ▼5.4642.64 ▲0.08
Posts /wp-admin/edit.php2,117 ▲202.01 ▲0.0636.48 ▼1.3734.58 ▼4.78
Add New Post /wp-admin/post-new.php1,543 ▲1723.39 ▲0.34655.46 ▲8.1551.84 ▲2.66
Media Library /wp-admin/upload.php1,414 ▲114.21 ▲0.0998.21 ▲4.6941.48 ▲0.60

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_recent-comments
    • lab404_related_posts_version
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • lab404_related_posts_options
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 4× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/lab404-related-posts/templates/list_tpl.php
    • > /wp-content/plugins/lab404-related-posts/templates/pro_version_tpl.php
    • > /wp-content/plugins/lab404-related-posts/templates/instructions_tpl.php
    • > /wp-content/plugins/lab404-related-posts/templates/boxes_tpl.php
  • 6× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Notice
      Undefined variable: cat_posts in wp-content/plugins/lab404-related-posts/templates/list_tpl.php on line 3
    • > PHP Notice
      Undefined variable: related_posts_title in wp-content/plugins/lab404-related-posts/templates/boxes_tpl.php on line 1
    • > PHP Notice
      Undefined variable: cat_posts in wp-content/plugins/lab404-related-posts/templates/boxes_tpl.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/lab404-related-posts/templates/admin_home_tpl.php:9
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/lab404-related-posts/templates/boxes_tpl.php on line 3
    • > PHP Notice
      Undefined variable: related_posts_title in wp-content/plugins/lab404-related-posts/templates/list_tpl.php on line 1

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Tags: You are using too many tags: 14 tag instead of maximum 10
The official readme.txt is a good inspiration

lab404-related-posts/index.php 92% from 13 tests

The main PHP script in "Lab404 Related Posts" version 1.1 is automatically included on every request by WordPress
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("lab404-related-posts.php" instead of "index.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
There were no executable files found in this plugin662 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP79482468
CSS232181
JavaScript12013

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity28.00
▷ Minimum class complexity23.00
▷ Maximum class complexity33.00
Average method complexity3.84
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods19
▷ Static methods947.37%
▷ Public methods1894.74%
▷ Protected methods00.00%
▷ Private methods15.26%
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

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