84% nth-order-discount-for-woocommerce

Code Review | Nth Order Discount for WooCommerce

WordPress plugin Nth Order Discount for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: nth-order-discoun...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-5.0.2
  • WordPress version: 6.3.1
  • First release: Jan 5, 2019
  • Latest release: Jan 6, 2019
  • Number of updates: 3
  • Update frequency: every 0.7 days
  • Top authors: dimadin (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /823 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.01MB] [CPU: ▼13.82ms] Passed 4 tests

Analyzing server-side resources used by Nth Order Discount for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0237.71 ▼5.54
Dashboard /wp-admin3.33 ▼0.0251.84 ▼18.86
Posts /wp-admin/edit.php3.38 ▲0.0251.28 ▼4.46
Add New Post /wp-admin/post-new.php5.91 ▲0.0289.95 ▼26.43
Media Library /wp-admin/upload.php3.25 ▲0.0240.89 ▲1.08

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 10 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Nth Order Discount for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,817 ▲5614.35 ▼0.011.91 ▲0.2343.17 ▲3.15
Dashboard /wp-admin2,201 ▲215.70 ▲0.1784.53 ▼1.3439.31 ▼5.16
Posts /wp-admin/edit.php2,103 ▼02.00 ▲0.0338.20 ▼2.5739.13 ▲2.66
Add New Post /wp-admin/post-new.php1,538 ▲718.15 ▼4.81639.86 ▼99.4866.80 ▲1.55
Media Library /wp-admin/upload.php1,397 ▼04.23 ▲0.0697.65 ▼1.1344.01 ▼7.60

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts

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 no errors were found, this is by no means an exhaustive test

SRP 50% 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
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/nth-order-discount-for-woocommerce/nth-order-discount-for-woocommerce.php:53
    • > PHP Fatal error
      Trait 'dimadin\\WP\\Plugin\\WC\thOrderDiscount\\Singleton' not found in wp-content/plugins/nth-order-discount-for-woocommerce/inc/Main.php on line 23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% 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
1 plugin tags: woocommerce

nth-order-discount-for-woocommerce/nth-order-discount-for-woocommerce.php 85% from 13 tests

The principal PHP file in "Nth Order Discount for WooCommerce" v. 1.0.0 is loaded by WordPress automatically on each request
The following require your attention:
  • Requires at least: Required version must match the one declared in readme.txt ("4.7" instead of "3.1")
  • Domain Path: The domain path is invalid: folder "/languages/" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected331 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP882321292
XML15839

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity5.57
▷ Minimum class complexity1.00
▷ Maximum class complexity26.00
Average method complexity2.39
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces3
Interfaces0
Traits1
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods23
▷ Static methods2295.65%
▷ Public methods23100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There are no PNG files in this plugin