90% coupon-by-user-role-for-woocommerce

Code Review | Coupon by User Role for WooCommerce

WordPress plugin Coupon by User Role for WooCommerce scored90%from 54 tests.

About plugin

  • Plugin page: coupon-by-user-ro...
  • Plugin version: 2.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.4
  • WordPress version: 6.3.1
  • First release: Feb 25, 2021
  • Latest release: Nov 14, 2023
  • Number of updates: 14
  • Update frequency: every 70.9 days
  • Top authors: algoritmika (71.43%)wpcodefactory (35.71%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /1,466 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
The plugin installed gracefully, with no errors

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

Server-side resources used by Coupon by User Role for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0234.67 ▼5.75
Dashboard /wp-admin3.33 ▼0.0246.07 ▼10.98
Posts /wp-admin/edit.php3.38 ▲0.0247.20 ▼3.19
Add New Post /wp-admin/post-new.php5.91 ▲0.0279.51 ▼27.28
Media Library /wp-admin/upload.php3.25 ▲0.0232.40 ▲0.84

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 13 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Coupon by User Role for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.21 ▼0.141.68 ▲0.1538.97 ▼0.88
Dashboard /wp-admin2,189 ▲125.51 ▼0.1492.04 ▲0.8640.14 ▼0.76
Posts /wp-admin/edit.php2,100 ▼02.00 ▲0.0639.74 ▲0.7635.88 ▲0.54
Add New Post /wp-admin/post-new.php1,526 ▼123.26 ▲0.15671.92 ▲42.9747.41 ▼6.41
Media Library /wp-admin/upload.php1,403 ▲34.32 ▲0.0699.84 ▲2.7345.57 ▲1.00

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 were found after uninstall: 6 options
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget

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)
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
Looking good! No server-side errors or output on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
4 plugin tags: woo commerce, coupon, user role, woocommerce

coupon-by-user-role-for-woocommerce/coupon-by-user-role-for-woocommerce.php Passed 13 tests

The main PHP script in "Coupon by User Role for WooCommerce" version 2.1.0 is automatically included on every request by WordPress
34 characters long description:
WooCommerce coupons by user roles.

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
Success! There were no dangerous files found in this plugin670 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP10134519670

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.54
Average class complexity9.22
▷ Minimum class complexity1.00
▷ Maximum class complexity36.00
Average method complexity2.48
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes111.11%
Methods50
▷ Static methods12.00%
▷ Public methods50100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
PNG images were not found in this plugin