89% woo-coupons-by-role

Code Review | Coupons by Role

WordPress plugin Coupons by Role scored89%from 54 tests.

About plugin

  • Plugin page: woo-coupons-by-role
  • Plugin version: 1.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-6.1
  • WordPress version: 6.3.1
  • First release: Dec 20, 2017
  • Latest release: Oct 26, 2022
  • Number of updates: 5
  • Update frequency: every 355.2 days
  • Top authors: sirrahikkala (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /576 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

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

Server-side resources used by Coupons by Role
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0243.63 ▲5.57
Dashboard /wp-admin3.31 ▲0.0143.39 ▼3.69
Posts /wp-admin/edit.php3.36 ▲0.0143.87 ▼7.98
Add New Post /wp-admin/post-new.php5.89 ▲0.0190.66 ▼8.15
Media Library /wp-admin/upload.php3.24 ▲0.0134.21 ▼0.03

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Coupons by Role
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.16 ▼1.131.74 ▼0.2541.03 ▲0.50
Dashboard /wp-admin2,209 ▲205.90 ▲0.8895.80 ▼25.4837.13 ▼6.11
Posts /wp-admin/edit.php2,092 ▼01.99 ▼0.0338.93 ▼0.9935.01 ▼1.73
Add New Post /wp-admin/post-new.php1,514 ▼1917.84 ▼5.37625.22 ▼65.3049.93 ▼6.84
Media Library /wp-admin/upload.php1,388 ▼04.20 ▲0.0297.10 ▼6.5841.88 ▼3.21

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP Passed 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
Congratulations! This plugin passed the SRP test

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
4 plugin tags: role, group, coupon, woocommerce

woo-coupons-by-role/hide-coupon-by-role.php 77% from 13 tests

The main PHP file in "Coupons by Role" ver. 1.2 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("woo-coupons-by-role.php" instead of "hide-coupon-by-role.php")
  • Text Domain: Please use dashes and lowercase characters for text domains
  • Description: Please don't use more than 140 characters for the plugin description (currently 200 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected94 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1265694

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity2.00
▷ Minimum class complexity2.00
▷ Maximum class complexity2.00
Average method complexity1.20
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods5
▷ Static methods5100.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.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
No PNG images were found in this plugin