90% global-shop-discount-for-woocommerce

Code Review | Global Shop Discount for WooCommerce

WordPress plugin Global Shop Discount for WooCommerce scored90%from 54 tests.

About plugin

  • Plugin page: global-shop-disco...
  • Plugin version: 1.9.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.4
  • WordPress version: 6.3.1
  • First release: Jun 7, 2018
  • Latest release: Nov 10, 2023
  • Number of updates: 33
  • Update frequency: every 60.1 days
  • Top authors: algoritmika (66.67%)wpcodefactory (36.36%)

Code review

54 tests

User reviews

4 reviews

Install metrics

500+ active /7,855 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.01MB] [CPU: ▼6.26ms] Passed 4 tests

Analyzing server-side resources used by Global Shop Discount for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0040.67 ▲3.65
Dashboard /wp-admin3.31 ▼0.0446.93 ▼14.26
Posts /wp-admin/edit.php3.36 ▲0.0046.00 ▲1.27
Add New Post /wp-admin/post-new.php5.89 ▲0.0081.38 ▼12.86
Media Library /wp-admin/upload.php3.23 ▲0.0033.41 ▲0.82

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_recent-posts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Global Shop Discount for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.33 ▼0.021.76 ▲0.2046.54 ▲2.83
Dashboard /wp-admin2,192 ▲155.53 ▼0.1088.93 ▼3.9437.58 ▼3.40
Posts /wp-admin/edit.php2,103 ▲31.95 ▼0.0339.23 ▲4.7235.64 ▼1.13
Add New Post /wp-admin/post-new.php1,526 ▼022.96 ▼0.31668.94 ▲69.6356.54 ▼8.24
Media Library /wp-admin/upload.php1,397 ▼64.20 ▲0.00101.27 ▼1.0040.95 ▼0.99

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

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

SRP Passed 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
No output text or server-side errors detected on direct access of PHP files

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

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Add an image for screenshot #1 (Discount settings.)
You can take inspiration from this readme.txt

global-shop-discount-for-woocommerce/global-shop-discount-for-woocommerce.php Passed 13 tests

Analyzing the main PHP file in "Global Shop Discount for WooCommerce" version 1.9.5
66 characters long description:
Add global shop discount to all WooCommerce products. Beautifully.

Code Analysis Passed 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
No dangerous file extensions were detected1,156 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP112436031,156

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.56
Average class complexity18.56
▷ Minimum class complexity1.00
▷ Maximum class complexity102.00
Average method complexity3.52
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes111.11%
Methods59
▷ Static methods11.69%
▷ Public methods59100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions480.00%
▷ Anonymous functions120.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
PNG images were not found in this plugin