78% elex-discount-per-country

Code Review | ELEX WooCommerce Discount Per Country

WordPress plugin ELEX WooCommerce Discount Per Country scored78%from 54 tests.

About plugin

  • Plugin page: elex-discount-per...
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6.0+
  • WordPress version: 6.3.1
  • First release: Oct 6, 2021
  • Latest release: Nov 10, 2023
  • Number of updates: 14
  • Update frequency: every 54.7 days
  • Top authors: elextensions (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /932 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

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

An overview of server-side resources used by ELEX WooCommerce Discount Per Country
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0139.07 ▼0.29
Dashboard /wp-admin3.32 ▼0.0345.30 ▼13.81
Posts /wp-admin/edit.php3.37 ▲0.0144.37 ▼4.73
Add New Post /wp-admin/post-new.php5.90 ▲0.0179.02 ▼15.22
Media Library /wp-admin/upload.php3.24 ▲0.0135.86 ▼0.05

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 27 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for ELEX WooCommerce Discount Per Country
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲7314.33 ▼0.051.98 ▲0.3042.95 ▼0.47
Dashboard /wp-admin2,215 ▲385.61 ▲0.0791.06 ▼11.7143.04 ▼1.60
Posts /wp-admin/edit.php2,121 ▲182.01 ▲0.0135.75 ▼1.5031.03 ▼4.28
Add New Post /wp-admin/post-new.php1,541 ▲1522.97 ▼0.17668.26 ▼13.6562.86 ▲11.73
Media Library /wp-admin/upload.php1,420 ▲174.16 ▼0.0398.60 ▼3.7342.15 ▼3.49

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • 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
Everything seems fine, however 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 perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/elex-discount-per-country/review_and_troubleshoot_notify/resources/logo.php
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-discount-per-country/review_and_troubleshoot_notify/resources/troubleshoot.php:59
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-discount-per-country/review_and_troubleshoot_notify/resources/review.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/elex-discount-per-country/includes/market.php:141
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/elex-discount-per-country/includes/class-discount-per-country.php:25

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)
There were no browser issues found

Optimizations

Plugin configuration 93% 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
Please fix the following attributes:
  • Donate link: Please fix this invalid url: ""
Please take inspiration from this readme.txt

elex-discount-per-country/elex-discount-per-country.php 92% from 13 tests

"ELEX WooCommerce Discount Per Country" version 1.1.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:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.0.1" instead of "2.6.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin8,668 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
CSS24386,920
PHP10192561,209
PO File37692346
JavaScript1906193

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity21.60
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity4.22
▷ Minimum method complexity1.00
▷ Maximum method complexity53.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods34
▷ Static methods12.94%
▷ Public methods34100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions116.67%
▷ Anonymous functions583.33%
Constants4
▷ Global constants125.00%
▷ Class constants375.00%
▷ Public constants3100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
7 PNG files occupy 0.57MB with 0.44MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/logo/bulk_edit.png69.40KB15.94KB▼ 77.03%
assets/logo/Hide WooCommerce.png79.45KB18.13KB▼ 77.19%
assets/logo/Request-a-quote.png92.71KB24.02KB▼ 74.09%
assets/logo/elex-name-your-price.png75.69KB17.13KB▼ 77.37%
assets/logo/Rolebased-plugin.png85.64KB21.17KB▼ 75.28%