90% woocommerce-payment-discounts

Code Review | Discounts Per Payment Method on WooCommerce

WordPress plugin Discounts Per Payment Method on WooCommerce scored90%from 54 tests.

About plugin

  • Plugin page: woocommerce-payme...
  • Plugin version: 3.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.5
  • WordPress version: 6.3.1
  • First release: Jan 18, 2013
  • Latest release: Aug 11, 2020
  • Number of updates: 31
  • Update frequency: every 89.1 days
  • Top authors: claudiosanches (100%)

Code review

54 tests

User reviews

33 reviews

Install metrics

2,000+ active /55,530 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
Installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼3.79ms] Passed 4 tests

Analyzing server-side resources used by Discounts Per Payment Method on WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0237.84 ▼3.14
Dashboard /wp-admin3.32 ▲0.0250.91 ▼2.11
Posts /wp-admin/edit.php3.37 ▲0.0248.92 ▼4.68
Add New Post /wp-admin/post-new.php5.90 ▲0.0291.82 ▲2.43
Media Library /wp-admin/upload.php3.24 ▲0.0233.73 ▼5.21

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 10 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
woocommerce_payment_discounts_version
woocommerce_payment_discounts
widget_recent-comments
db_upgraded
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Discounts Per Payment Method on WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,834 ▲6314.47 ▲0.091.84 ▼0.1240.29 ▼3.88
Dashboard /wp-admin2,218 ▲334.84 ▼1.03109.46 ▲0.2140.54 ▼3.64
Posts /wp-admin/edit.php2,100 ▲82.02 ▲0.0538.72 ▲0.8134.09 ▼1.93
Add New Post /wp-admin/post-new.php1,523 ▲917.84 ▲0.16682.33 ▼0.9974.58 ▲18.07
Media Library /wp-admin/upload.php1,397 ▲94.30 ▲0.1499.49 ▲5.3843.21 ▼2.93

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests Passed 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)
Everything seems fine, however this is by no means an exhaustive test

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 96% 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
3 plugin tags: woocommerce, coupon, discount

woocommerce-payment-discounts/woocommerce-payment-discounts.php 92% from 13 tests

Analyzing the main PHP file in "Discounts Per Payment Method on WooCommerce" version 3.1.0
Please take the time to fix the following:
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.0" instead of "3.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
There were no executable files found in this plugin302 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP689227293
JavaScript2139

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity10.75
▷ Minimum class complexity7.00
▷ Maximum class complexity19.00
Average method complexity2.56
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods25
▷ Static methods728.00%
▷ Public methods1768.00%
▷ Protected methods624.00%
▷ Private methods28.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG images were found in this plugin