84% custom-related-products-for-woocommerce

Code Review | Custom Related Products for WooCommerce

WordPress plugin Custom Related Products for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: custom-related-pr...
  • Plugin version: 1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.6
  • WordPress version: 6.3.1
  • First release: Dec 2, 2014
  • Latest release: Feb 7, 2021
  • Number of updates: 14
  • Update frequency: every 161.4 days
  • Top authors: scottnelle (100%)

Code review

54 tests

User reviews

33 reviews

Install metrics

8,000+ active /54,715 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
This plugin's installer ran successfully

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

This is a short check of server-side resources used by Custom Related Products for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0241.07 ▼3.12
Dashboard /wp-admin3.32 ▲0.0151.90 ▲0.74
Posts /wp-admin/edit.php3.37 ▲0.0151.96 ▼4.70
Add New Post /wp-admin/post-new.php5.90 ▲0.01105.54 ▲9.95
Media Library /wp-admin/upload.php3.24 ▲0.0134.92 ▲0.69
Custom Related Products /wp-admin/admin.php?page=custom_related_products3.2131.24

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Custom Related Products for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.21 ▼0.141.86 ▼0.2541.26 ▼7.77
Dashboard /wp-admin2,195 ▲215.62 ▲0.0591.25 ▼0.9839.85 ▼1.53
Posts /wp-admin/edit.php2,100 ▼02.14 ▲0.1640.20 ▲3.0735.73 ▼0.46
Add New Post /wp-admin/post-new.php1,526 ▼223.08 ▲0.17657.09 ▼24.6455.98 ▲1.48
Media Library /wp-admin/upload.php1,397 ▼04.23 ▲0.0299.29 ▼13.1544.20 ▼1.91
Custom Related Products /wp-admin/admin.php?page=custom_related_products7992.0225.5225.71

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
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

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)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/custom-related-products-for-woocommerce/woocommerce-custom-related-products.php:25

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
2 plugin tags: woocommerce, related products

custom-related-products-for-woocommerce/woocommerce-custom-related-products.php 92% from 13 tests

The main PHP file in "Custom Related Products for WooCommerce" ver. 1.3 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("custom-related-products-for-woocommerce.php" instead of "woocommerce-custom-related-products.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
Good job! No executable or dangerous file extensions detected142 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP11861142

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.48
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
No PNG files were detected