78% woo-compare-products

Code Review | WooCommerce Product Comparison by WooBeWoo

WordPress plugin WooCommerce Product Comparison by WooBeWoo scored78%from 54 tests.

About plugin

  • Plugin page: woo-compare-products
  • Plugin version: 1.2.9
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.0-5.4
  • WordPress version: 6.3.1
  • First release: Jun 19, 2018
  • Latest release: Jul 29, 2020
  • Number of updates: 37
  • Update frequency: every 20.8 days
  • Top authors: woobewoo (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,175 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.67MB] [CPU: ▲13.07ms] Passed 4 tests

An overview of server-side resources used by WooCommerce Product Comparison by WooBeWoo
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /5.15 ▲1.6855.26 ▲13.84
Dashboard /wp-admin4.98 ▲1.6860.10 ▲8.29
Posts /wp-admin/edit.php5.03 ▲1.6763.35 ▲12.56
Add New Post /wp-admin/post-new.php7.56 ▲1.67119.26 ▲20.58
Media Library /wp-admin/upload.php4.90 ▲1.6757.85 ▲17.57
Settings /wp-admin/admin.php?page=woo-compare-products&tab=settings5.0148.75
Woo Compare Products /wp-admin/admin.php?page=woo-compare-products5.0047.90

Server storage [IO: ▲4.49MB] [DB: ▲0.00MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
It is recommended to fix the following issues
  • Illegal file modification found: 1 file (4.00KB) outside of "wp-content/plugins/woo-compare-products/" and "wp-content/uploads/"
    • (new file) wp-content/mgd_mirror/mgd_maximinodotpy-gitdown-test-repository
Filesystem: 259 new files
Database: 3 new tables, 10 new options
New tables
wp_wcp_modules_type
wp_wcp_modules
wp_wcp_usage_stat
New WordPress options
can_compress_scripts
wcp_plugin_activation_errors
wcp_opts_data
theysaidso_admin_options
db_upgraded
wp_wcp_db_installed
widget_recent-posts
wp_wcp_db_version
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by WooCommerce Product Comparison by WooBeWoo
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,843 ▲8213.31 ▼1.495.17 ▲3.5541.69 ▼0.70
Dashboard /wp-admin2,246 ▲434.88 ▼1.02109.18 ▲6.7443.50 ▲4.79
Posts /wp-admin/edit.php2,125 ▲282.01 ▼0.0439.73 ▼0.3138.36 ▲2.94
Add New Post /wp-admin/post-new.php1,563 ▲3023.04 ▼0.15655.09 ▼2.7565.90 ▲11.59
Media Library /wp-admin/upload.php1,431 ▲314.19 ▼0.0497.39 ▼5.8346.25 ▼0.89
Settings /wp-admin/admin.php?page=woo-compare-products&tab=settings1,6894.7185.8452.15
Woo Compare Products /wp-admin/admin.php?page=woo-compare-products1,6864.7588.1236.44

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
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • wcp_plugin_activation_errors
    • wcp_opts_data
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=woo-compare-products
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 54× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/woo-compare-products/modules/supsystic_promo/views/tpl/additionalmainAdminShowOnOptions.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/woo-compare-products/modules/options/views/tpl/optionsSettingsTabContent.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'moduleWcp' not found in wp-content/plugins/woo-compare-products/modules/woo/mod.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'baseObjectWcp' not found in wp-content/plugins/woo-compare-products/classes/model.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'controllerWcp' not found in wp-content/plugins/woo-compare-products/modules/supsystic_promo/controller.php:2
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/woo-compare-products/config.php on line 21
    • > PHP Fatal error
      Uncaught Error: Class 'viewWcp' not found in wp-content/plugins/woo-compare-products/modules/admin_nav/views/admin_nav.php:2
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/woo-compare-products/config.php on line 11
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/woo-compare-products/modules/options/views/tpl/optionsAdminMain.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/woo-compare-products/modules/woo/views/tpl/frontendPopup.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Donate link: Invalid url: "woobewoo.com"
You can take inspiration from this readme.txt

woo-compare-products/wcp.php 92% from 13 tests

"WooCommerce Product Comparison by WooBeWoo" version 1.2.9's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("woo-compare-products.php" instead of "wcp.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
No dangerous file extensions were detected30,008 lines of code in 207 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript961,4032,58413,586
PHP755452,1859,825
CSS343862943,271
SVG1002,671
PO File1227263655

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity29.43
▷ Minimum class complexity1.00
▷ Maximum class complexity212.00
Average method complexity2.98
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes58
▷ Abstract classes915.52%
▷ Concrete classes4984.48%
▷ Final classes00.00%
Methods834
▷ Static methods28033.57%
▷ Public methods73287.77%
▷ Protected methods475.64%
▷ Private methods556.59%
Functions19
▷ Named functions19100.00%
▷ Anonymous functions00.00%
Constants95
▷ Global constants7073.68%
▷ Class constants2526.32%
▷ Public constants25100.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
33 PNG files occupy 0.23MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/ui-bg_gloss-wave_16_121212_500x100.png3.76KB0.98KB▼ 74.04%
js/jquery.context-menu/images/door.png0.40KB0.60KB0.00%
modules/supsystic_promo/img/forms-stats-promo.png89.70KB28.71KB▼ 67.99%
css/images/minimal.png2.23KB1.44KB▼ 35.45%
js/jquery.bootstrap.colorpicker/holder.png0.12KB0.14KB0.00%