83% woo-dynamic-pricing-discounts-lite

Code Review | Dynamic Pricing & Discounts Lite for WooCommerce

WordPress plugin Dynamic Pricing & Discounts Lite for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: woo-dynamic-prici...
  • Plugin version: 1.6.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.2.0
  • WordPress version: 6.3.1
  • First release: Jul 30, 2019
  • Latest release: Apr 29, 2023
  • Number of updates: 41
  • Update frequency: every 33.4 days
  • Top authors: redefiningtheweb (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

600+ active /15,021 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼2.44ms] Passed 4 tests

Analyzing server-side resources used by Dynamic Pricing & Discounts Lite for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0142.28 ▼0.15
Dashboard /wp-admin3.31 ▲0.0046.72 ▼4.82
Posts /wp-admin/edit.php3.36 ▲0.0045.03 ▼2.93
Add New Post /wp-admin/post-new.php5.89 ▲0.0094.73 ▼1.78
Media Library /wp-admin/upload.php3.23 ▲0.0033.90 ▼0.22

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 92 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Dynamic Pricing & Discounts Lite for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲8113.40 ▼0.994.34 ▲2.4942.37 ▼3.45
Dashboard /wp-admin2,225 ▲376.07 ▲0.2697.98 ▼8.8841.02 ▼0.63
Posts /wp-admin/edit.php2,105 ▲192.04 ▲0.0135.72 ▼3.5034.51 ▼0.13
Add New Post /wp-admin/post-new.php1,560 ▲2218.03 ▼5.45593.99 ▼58.3270.79 ▲4.32
Media Library /wp-admin/upload.php1,404 ▲134.17 ▼0.0697.53 ▲0.5441.43 ▲0.53

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

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 fix the following
  • 34× 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_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_subtabs/rtwwdpdl_variation_rule.php:160
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_tabs/rtwwdpdl_pro_section.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_subtabs/rtwwdpdl_cate_rule.php:349
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_subtabs/rtwwdpdl_prod_rule.php:356
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_subtabs/rtwwdpdl_tiered_cat.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_subtabs/rtwwdpdl_least_amt_pro.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_subtabs/rtwwdpdl_nth_order.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'RTWWDPDL_Module_Base' not found in wp-content/plugins/woo-dynamic-pricing-discounts-lite/public/classes/modules/rtwwdpdl-class-adv-base.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/woo-dynamic-pricing-discounts-lite/admin/partials/rtwwdpdl_subtabs/rtwwdpdl_shipping_method.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'RTWWDPDL_Adjustment_Set' not found in wp-content/plugins/woo-dynamic-pricing-discounts-lite/public/classes/rtwwdpdl-class-adj-set-category.php:7

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Tags: You are using too many tags: 15 tag instead of maximum 10
  • Screenshots: Screenshot #1 (Product Discount Rule.) image missing
You can take inspiration from this readme.txt

woo-dynamic-pricing-discounts-lite/dynamic-pricing-discounts-lite-for-woocommerce.php 77% from 13 tests

"Dynamic Pricing & Discounts Lite for WooCommerce" version 1.6.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Requires at least: The required version number must match the one declared in readme.txt ("5.0.0" instead of "3.0")
  • 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 ("woo-dynamic-pricing-discounts-lite.php" instead of "dynamic-pricing-discounts-lite-for-woocommerce.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin23,243 lines of code in 63 files:
LanguageFilesBlank linesComment linesLines of code
PHP4596393012,642
CSS91,118689,380
JavaScript985451,221

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
It is recommended to fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 312)
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity54.12
▷ Minimum class complexity1.00
▷ Maximum class complexity404.00
Average method complexity11.90
▷ Minimum method complexity1.00
▷ Maximum method complexity312.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes16
▷ Abstract classes318.75%
▷ Concrete classes1381.25%
▷ Final classes00.00%
Methods82
▷ Static methods1113.41%
▷ Public methods7287.80%
▷ Protected methods44.88%
▷ Private methods67.32%
Functions8
▷ Named functions562.50%
▷ Anonymous functions337.50%
Constants4
▷ Global constants4100.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
18 PNG files occupy 0.19MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/special-offer.png24.89KB10.91KB▼ 56.17%
assets/Datatables/images/dragndropp.png0.53KB0.40KB▼ 24.63%
assets/Datatables/images/sort_asc.png0.16KB0.25KB0.00%
assets/Datatables/images/sort_desc.png0.15KB0.25KB0.00%
assets/images/trending-offer.png87.41KB25.57KB▼ 70.75%