77% aco-woo-dynamic-pricing

Code Review | Dynamic Pricing With Discount Rules for WooCommerce

WordPress plugin Dynamic Pricing With Discount Rules for WooCommerce scored77%from 54 tests.

About plugin

  • Plugin page: aco-woo-dynamic-p...
  • Plugin version: 4.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.3
  • WordPress version: 6.3.1
  • First release: Mar 20, 2019
  • Latest release: Nov 8, 2023
  • Number of updates: 140
  • Update frequency: every 12.1 days
  • Top authors: acowebs (64.29%)acowebscd (36.43%)

Code review

54 tests

User reviews

54 reviews

Install metrics

7,000+ active /205,235 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.99MB] [CPU: ▲4.15ms] Passed 4 tests

Analyzing server-side resources used by Dynamic Pricing With Discount Rules for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.44 ▲0.9847.93 ▲2.95
Dashboard /wp-admin4.32 ▲1.0255.13 ▲5.36
Posts /wp-admin/edit.php4.37 ▲1.0249.98 ▲0.86
Add New Post /wp-admin/post-new.php6.89 ▲1.00100.29 ▲7.44
Media Library /wp-admin/upload.php4.18 ▲0.9543.34 ▲8.16

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

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

Browser metrics Passed 4 tests

Dynamic Pricing With Discount Rules for WooCommerce: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3114.01 ▼0.331.83 ▲0.1343.18 ▲0.95
Dashboard /wp-admin2,198 ▲185.62 ▼0.0484.46 ▼8.6639.83 ▼4.31
Posts /wp-admin/edit.php2,103 ▲31.97 ▲0.0234.94 ▼6.3434.56 ▼5.83
Add New Post /wp-admin/post-new.php1,529 ▲323.59 ▲0.46589.19 ▼2.7959.13 ▼4.82
Media Library /wp-admin/upload.php1,406 ▲64.19 ▼0.0195.97 ▼7.6543.54 ▼0.66

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_recent-comments
    • awdp_version
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
Please fix the following
  • 4× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-help.php
    • > /wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-root.php
    • > /wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-lists.php
    • > /wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-settings.php
  • 5× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      Use of undefined constant AWDP_TOKEN - assumed 'AWDP_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-help.php on line 1
    • > PHP Warning
      Use of undefined constant AWDP_TOKEN - assumed 'AWDP_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-root.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/aco-woo-dynamic-pricing/start.php:27
    • > PHP Warning
      Use of undefined constant AWDP_TOKEN - assumed 'AWDP_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-lists.php on line 1
    • > PHP Warning
      Use of undefined constant AWDP_TOKEN - assumed 'AWDP_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-woo-dynamic-pricing/includes/views/admin-settings.php on line 1

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% 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
Attributes that require attention:
  • Donate link: Invalid URI found ("")
You can take inspiration from this readme.txt

aco-woo-dynamic-pricing/start.php 85% from 13 tests

"Dynamic Pricing With Discount Rules for WooCommerce" version 4.5.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Description: The description should be shorter than 140 characters (currently 152 characters long)
  • Main file name: Name the main plugin file the same as the plugin slug ("aco-woo-dynamic-pricing.php" instead of "start.php")

Code Analysis 97% from 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
Good job! No executable or dangerous file extensions detected8,160 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
PHP191,5051,0445,477
JSON3001,735
PO File1244244524
CSS2223178
JavaScript41437153
SVG40071
XML10022

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
These items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 293)
Cyclomatic complexity
Average complexity per logical line of code0.70
Average class complexity134.15
▷ Minimum class complexity1.00
▷ Maximum class complexity714.00
Average method complexity13.97
▷ Minimum method complexity1.00
▷ Maximum method complexity293.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes00.00%
Methods134
▷ Static methods53.73%
▷ Public methods13298.51%
▷ Protected methods10.75%
▷ Private methods10.75%
Functions12
▷ Named functions541.67%
▷ Anonymous functions758.33%
Constants13
▷ Global constants13100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
28 PNG files occupy 0.25MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/js/images/link-go.png1.02KB0.24KB▼ 77.00%
assets/js/images/plan-info.png19.93KB21.76KB0.00%
assets/images/ticket_bg.png59.50KB65.99KB0.00%
assets/images/delete.png0.65KB0.74KB0.00%
assets/images/calendar-icon.png1.18KB0.33KB▼ 72.29%