77% elex-woocommerce-dynamic-pricing-and-discounts

Code Review | ELEX WooCommerce Dynamic Pricing and Discounts

WordPress plugin ELEX WooCommerce Dynamic Pricing and Discounts scored77%from 54 tests.

About plugin

  • Plugin page: elex-woocommerce-...
  • Plugin version: 2.0.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.3
  • WordPress version: 6.3.1
  • First release: Jun 17, 2019
  • Latest release: Sep 14, 2023
  • Number of updates: 43
  • Update frequency: every 36.1 days
  • Top authors: elextensions (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

1,000+ active /43,599 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: ▼0.76ms] Passed 4 tests

This is a short check of server-side resources used by ELEX WooCommerce Dynamic Pricing and Discounts
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0035.29 ▼0.59
Dashboard /wp-admin3.31 ▲0.0143.67 ▼3.93
Posts /wp-admin/edit.php3.36 ▲0.0043.92 ▼1.97
Add New Post /wp-admin/post-new.php5.89 ▲0.0088.97 ▲7.35
Media Library /wp-admin/upload.php3.23 ▲0.0034.28 ▲3.44

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 164 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

ELEX WooCommerce Dynamic Pricing and Discounts: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲6013.32 ▼1.051.61 ▲0.0839.08 ▼5.33
Dashboard /wp-admin2,212 ▲215.83 ▲0.9595.46 ▼5.4140.96 ▼4.33
Posts /wp-admin/edit.php2,095 ▲62.01 ▼0.0035.47 ▼1.9938.01 ▲3.21
Add New Post /wp-admin/post-new.php1,539 ▲1723.24 ▼0.26644.43 ▲0.6564.70 ▲6.53
Media Library /wp-admin/upload.php1,388 ▼04.29 ▲0.1096.07 ▼5.1140.56 ▼1.55

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

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

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/includes/review_and_troubleshoot_notify/resources/logo.php
  • 7× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/includes/elex-common-functions.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/includes/review_and_troubleshoot_notify/resources/review.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/admin/ui/view/market.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/includes/review_and_troubleshoot_notify/resources/troubleshoot.php:59
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/includes/wf_api_manager/html/html-wf-activation-window.php:111
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/admin/elex-ajax-function.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/elex-woocommerce-dynamic-pricing-and-discounts/includes/wf_api_manager/wf-api-manager-config.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: woocommerce, dynamic pricing, price rule, dynamic discount, bulk discount

elex-woocommerce-dynamic-pricing-and-discounts/elex-dynamic-pricing-and-discounts-for-woocommerce-basic-version.php 77% from 13 tests

"ELEX WooCommerce Dynamic Pricing and Discounts" version 2.0.0'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:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 163 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("elex-woocommerce-dynamic-pricing-and-discounts.php" instead of "elex-dynamic-pricing-and-discounts-for-woocommerce-basic-version.php")
  • Requires at least: The required version number must match the one declared in readme.txt ("3.0.1" instead of "3.0.0")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Success! There were no dangerous files found in this plugin57,230 lines of code in 107 files:
LanguageFilesBlank linesComment linesLines of code
CSS1215124423,932
JSON40014,984
PHP591,2189728,746
PO File91,7105,2025,350
JavaScript66262421,886
SVG13001,463
HTML19716445
Sass34415424

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 1,035)
Cyclomatic complexity
Average complexity per logical line of code0.74
Average class complexity82.31
▷ Minimum class complexity1.00
▷ Maximum class complexity1,035.00
Average method complexity13.13
▷ Minimum method complexity1.00
▷ Maximum method complexity93.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes16
▷ Abstract classes00.00%
▷ Concrete classes16100.00%
▷ Final classes00.00%
Methods109
▷ Static methods54.59%
▷ Public methods10192.66%
▷ Protected methods00.00%
▷ Private methods87.34%
Functions45
▷ Named functions4395.56%
▷ Anonymous functions24.44%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
41 PNG files occupy 2.23MB with 1.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/wsdesk.png161.93KB43.90KB▼ 72.89%
admin/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
jquery-ui/images/ui-icons_cc0000_256x240.png4.44KB4.17KB▼ 6.02%
img/catalog_mode.png85.64KB21.17KB▼ 75.28%
img/dynamic_pricing.png90.78KB22.92KB▼ 74.75%