83% woo-advanced-discounts

Code Review | Conditional Discounts for WooCommerce - A simple yet complete woocommerce dynamic pricing plugin

WordPress plugin Conditional Discounts for WooCommerce - A simple yet complete woocommerce dynamic pricing plugin scored83%from 54 tests.

About plugin

  • Plugin page: woo-advanced-disc...
  • Plugin version: 2.31.5
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.2
  • WordPress version: 6.3.1
  • First release: Sep 22, 2015
  • Latest release: May 25, 2023
  • Number of updates: 169
  • Update frequency: every 16.6 days
  • Top authors: mano88 (94.08%)donaldlaly (6.51%)

Code review

54 tests

User reviews

124 reviews

Install metrics

10,000+ active /327,344 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.66MB] [CPU: ▼10.18ms] Passed 4 tests

A check of server-side resources used by Conditional Discounts for WooCommerce - A simple yet complete woocommerce dynamic pricing plugin
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.09 ▲0.6336.18 ▼7.35
Dashboard /wp-admin4.03 ▲0.6849.62 ▼15.18
Posts /wp-admin/edit.php4.08 ▲0.7250.61 ▲3.41
Add New Post /wp-admin/post-new.php6.57 ▲0.6893.20 ▼21.58
Media Library /wp-admin/upload.php3.89 ▲0.6639.94 ▲6.97
Discounts /wp-admin/edit.php?post_type=o-discount3.9939.49
New discount /wp-admin/post-new.php?post_type=o-discount4.0148.65

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

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

Browser metrics Passed 4 tests

Conditional Discounts for WooCommerce - A simple yet complete woocommerce dynamic pricing plugin: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,850 ▲10413.84 ▼0.904.66 ▲2.6218.23 ▼24.77
Dashboard /wp-admin2,281 ▲935.07 ▼0.79101.79 ▼3.6986.70 ▲45.24
Posts /wp-admin/edit.php2,182 ▲1112.34 ▲0.2943.80 ▲8.3538.31 ▲4.24
Add New Post /wp-admin/post-new.php1,601 ▲6823.40 ▲0.32613.15 ▼43.2744.09 ▼9.21
Media Library /wp-admin/upload.php1,472 ▲874.50 ▲0.3099.67 ▼1.2572.80 ▲28.56
Discounts /wp-admin/edit.php?post_type=o-discount1,1712.2732.5430.42
New discount /wp-admin/post-new.php?post_type=o-discount2,0112.9272.5382.53

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
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-advanced-discounts/includes/class-wad-products-list.php:151

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 86% 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 your attention:
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
The official readme.txt is a good inspiration

woo-advanced-discounts/wad.php 77% from 13 tests

The main file in "Conditional Discounts for WooCommerce - A simple yet complete woocommerce dynamic pricing plugin" v. 2.31.5 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Plugin Name: It is recommended to keep the plugin name shorter than 70 characters (currently 96 characters long)
  • Requires at least: The required version number must match the one declared in readme.txt ("3.5" instead of "3.0.0")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("woo-advanced-discounts.php" instead of "wad.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected10,251 lines of code in 40 files:
LanguageFilesBlank linesComment linesLines of code
PHP145101,0533,595
CSS111701783,245
JavaScript122981902,584
PO File2314324803
SVG10124

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 108)
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity43.70
▷ Minimum class complexity1.00
▷ Maximum class complexity200.00
Average method complexity4.22
▷ Minimum method complexity1.00
▷ Maximum method complexity108.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes00.00%
Methods122
▷ Static methods2419.67%
▷ Public methods10586.07%
▷ Protected methods00.00%
▷ Private methods1713.93%
Functions28
▷ Named functions1967.86%
▷ Anonymous functions932.14%
Constants6
▷ Global constants583.33%
▷ Class constants116.67%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
25 PNG files occupy 0.08MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/wad-dashicon---.png17.31KB0.57KB▼ 96.72%
admin/js/o-datepicker/images/custom_t.png0.16KB0.11KB▼ 32.08%
admin/js/o-datepicker/images/custom_r.png0.16KB0.11KB▼ 32.12%
admin/js/o-datepicker/images/custom_b.png0.17KB0.13KB▼ 27.93%
admin/js/o-datepicker/images/datepicker_l.png0.13KB0.11KB▼ 16.79%