84% th-product-compare

Code Review | Product Compare for WooCommerce

WordPress plugin Product Compare for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: th-product-compare
  • Plugin version: 1.2.8
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Dec 22, 2021
  • Latest release: Nov 3, 2023
  • Number of updates: 21
  • Update frequency: every 32.8 days
  • Top authors: themehunk (100%)

Code review

54 tests

User reviews

1 review

Install metrics

6,000+ active /63,760 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.17MB] [CPU: ▼0.70ms] Passed 4 tests

This is a short check of server-side resources used by Product Compare for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1640.76 ▲2.59
Dashboard /wp-admin3.46 ▲0.1647.79 ▼4.72
Posts /wp-admin/edit.php3.58 ▲0.2245.16 ▼0.72
Add New Post /wp-admin/post-new.php6.07 ▲0.1893.49 ▲0.05
Media Library /wp-admin/upload.php3.39 ▲0.1638.62 ▲6.24
ThemeHunk /wp-admin/admin.php?page=themehunk-plugins3.4034.09
Product Compare /wp-admin/admin.php?page=th-product-compare3.3833.35

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Product Compare for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,014 ▲25213.78 ▼0.5413.79 ▲12.1542.70 ▼3.85
Dashboard /wp-admin2,257 ▲805.66 ▲0.1587.63 ▼6.6391.23 ▲47.95
Posts /wp-admin/edit.php2,160 ▲602.10 ▲0.1335.88 ▼1.9940.25 ▲4.76
Add New Post /wp-admin/post-new.php1,650 ▲12423.46 ▲0.42660.51 ▼50.90199.84 ▲144.69
Media Library /wp-admin/upload.php1,459 ▲594.22 ▲0.07100.84 ▼2.8078.11 ▲32.35
ThemeHunk /wp-admin/admin.php?page=themehunk-plugins1,2831.8633.1351.74
Product Compare /wp-admin/admin.php?page=th-product-compare1,5152.0125.6256.47

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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 take a closer look at the following
  • 12× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/th-product-compare/admin/themehunk-menu/plugins-list.php:4
    • > PHP Warning
      include_once(THEMEHUNK_PDIRth-option/header.php): failed to open stream: No such file or directory in wp-content/plugins/th-product-compare/admin/themehunk-menu/th-option/tab-html.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/th-product-compare/admin/themehunk-menu/admin-menu.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/th-product-compare/admin/themehunk-menu/th-option/tab-html.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/th-product-compare/admin/themehunk-menu/th-option/sidebar.php:4
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin-install.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/th-product-compare/admin/themehunk-menu/admin-menu.php on line 3
    • > PHP Warning
      include_once(): Failed opening 'THEMEHUNK_PDIRth-option/header.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/th-product-compare/admin/themehunk-menu/th-option/tab-html.php on line 13
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin-install.php): failed to open stream: No such file or directory in wp-content/plugins/th-product-compare/admin/themehunk-menu/admin-menu.php on line 3
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/th-product-compare/admin/themehunk-menu/admin-menu.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/th-product-compare/admin/themehunk-menu/th-option/header.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Please add descriptions for these screenshots #1, #2, #3, #4, #5 in th-product-compare/assets to your readme.txt
The official readme.txt is a good inspiration

th-product-compare/th-product-compare.php 92% from 13 tests

"Product Compare for WooCommerce" version 1.2.8's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Description: The description should be shorter than 140 characters (currently 616 characters long)

Code Analysis Passed 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
Everything looks great! No dangerous files found in this plugin6,629 lines of code in 42 files:
LanguageFilesBlank linesComment linesLines of code
CSS9206462,917
PHP19365721,574
Sass10201751,344
JavaScript33889593
PO File18181201

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity30.50
▷ Minimum class complexity9.00
▷ Maximum class complexity96.00
Average method complexity4.61
▷ Minimum method complexity1.00
▷ Maximum method complexity45.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods49
▷ Static methods612.24%
▷ Public methods4591.84%
▷ Protected methods00.00%
▷ Private methods48.16%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
14 PNG files occupy 0.42MB with 0.27MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/pro-img/advance-product-compare.png42.96KB12.91KB▼ 69.94%
admin/themehunk-menu/th-option/assets/images/ico.png8.40KB0.67KB▼ 91.99%
assets/img/th-logo.png3.35KB1.55KB▼ 53.63%
assets/img/pro-img/product-compare-style.png67.39KB27.29KB▼ 59.50%
admin/themehunk-menu/th-option/assets/images/icon.png14.32KB7.45KB▼ 47.95%