10% wc-category-discount

Code Review | Category Discounts for WooCommerce

WordPress plugin Category Discounts for WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: wc-category-discount
  • Plugin version: 1.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6.1-5.2.1
  • WordPress version: 6.3.1
  • First release: Feb 7, 2019
  • Latest release: May 24, 2019
  • Number of updates: 22
  • Update frequency: every 4.9 days
  • Top authors: flycart (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

200+ active /4,118 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
These installer errors require your attention
  • Install procedure validation failed for this plugin
    • > Warning in wp-content/plugins/wc-category-discount/woocommerce-category-discount.php+41
    Use of undefined constant RNOC_TEXT_DOMAIN - assumed 'RNOC_TEXT_DOMAIN' (this will throw an Error in a future version of PHP)

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

This is a short check of server-side resources used by Category Discounts for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0039.36 ▼2.50
Dashboard /wp-admin3.31 ▼0.0444.87 ▼17.80
Posts /wp-admin/edit.php3.36 ▲0.0046.52 ▼3.70
Add New Post /wp-admin/post-new.php5.89 ▲0.0086.40 ▼5.06
Media Library /wp-admin/upload.php3.23 ▲0.0038.93 ▲3.19

Server storage [IO: ▲1.83MB] [DB: ▲0.07MB] Passed 3 tests

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 180 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Category Discounts for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲4314.33 ▲0.161.80 ▲0.1741.06 ▲0.45
Dashboard /wp-admin2,189 ▲115.57 ▼0.1483.68 ▼20.8635.37 ▼6.08
Posts /wp-admin/edit.php2,079 ▼212.00 ▲0.0535.48 ▼2.4432.35 ▼1.04
Add New Post /wp-admin/post-new.php1,531 ▼723.01 ▲5.03595.64 ▼42.3991.75 ▼1.03
Media Library /wp-admin/upload.php1,400 ▲34.13 ▼0.0498.31 ▼8.4445.45 ▲3.47

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 50% 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 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/apigen/hook-docs.php
  • 41× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Multi_Base' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_Radio.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Base' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/CMB2_Field.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/init.php:126
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_Multi_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_Textarea.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_Picker_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Base' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_Taxonomy_Select.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Picker_Base' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_Oembed.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/wc-category-discount/vendor/cmb2/cmb2/includes/types/CMB2_Type_File_Base.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Please fix the following attributes: The official readme.txt might help

wc-category-discount/woocommerce-category-discount.php 77% from 13 tests

The principal PHP file in "Category Discounts for WooCommerce" v. 1.0.4 is loaded by WordPress automatically on each request
The following require your attention:
  • Requires at least: Required version must match the one declared in readme.txt ("4.4.1" instead of "4.6.1")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("wc-category-discount.php" instead of "woocommerce-category-discount.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin22,372 lines of code in 123 files:
LanguageFilesBlank linesComment linesLines of code
PHP712,3666,7078,869
CSS161,2721,1645,107
JSON2003,540
JavaScript154916572,582
Sass16300251,379
Markdown22140632
PO File1115149263

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity21.77
▷ Minimum class complexity1.00
▷ Maximum class complexity198.00
Average method complexity3.60
▷ Minimum method complexity1.00
▷ Maximum method complexity64.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes77
▷ Abstract classes911.69%
▷ Concrete classes6888.31%
▷ Final classes00.00%
Methods626
▷ Static methods10116.13%
▷ Public methods52583.87%
▷ Protected methods9415.02%
▷ Private methods71.12%
Functions42
▷ Named functions3685.71%
▷ Anonymous functions614.29%
Constants15
▷ Global constants746.67%
▷ Class constants853.33%
▷ Public constants8100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
22 PNG files occupy 0.02MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/cmb2/cmb2/apigen/theme-bootstrap/src/resources/resize.png0.12KB0.10KB▼ 13.22%
vendor/cmb2/cmb2/apigen/theme-bootstrap/src/resources/inherit.png0.15KB0.10KB▼ 29.61%
vendor/cmb2/cmb2/apigen/theme-bootstrap/src/resources/tree-hasnext.png0.13KB0.09KB▼ 31.25%
vendor/cmb2/cmb2/images/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%
vendor/cmb2/cmb2/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%