84% coupon-by-roles-for-woocommerce

Code Review | Coupon By Roles For WooCommerce

WordPress plugin Coupon By Roles For WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: coupon-by-roles-f...
  • Plugin version: 0.6
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.7.2
  • WordPress version: 6.3.1
  • First release: Apr 23, 2019
  • Latest release: Jul 8, 2021
  • Number of updates: 11
  • Update frequency: every 73.4 days
  • Top authors: tripathytanmay (54.55%)zetamatic (36.36%)pitabas106 (27.27%)

Code review

54 tests

User reviews

2 reviews

Install metrics

300+ active /2,607 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 successfully, without throwing any errors or notices

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

A check of server-side resources used by Coupon By Roles For WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0234.25 ▼3.21
Dashboard /wp-admin3.31 ▲0.0144.01 ▼4.89
Posts /wp-admin/edit.php3.37 ▲0.0143.84 ▼1.86
Add New Post /wp-admin/post-new.php5.90 ▲0.01105.81 ▲0.87
Media Library /wp-admin/upload.php3.24 ▲0.0133.67 ▼1.14

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Coupon By Roles For WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.48 ▼0.201.57 ▼0.2543.35 ▼0.51
Dashboard /wp-admin2,206 ▲174.90 ▼0.11104.03 ▼19.2640.05 ▼8.99
Posts /wp-admin/edit.php2,089 ▼02.18 ▲0.1438.26 ▲1.6041.66 ▲7.36
Add New Post /wp-admin/post-new.php1,528 ▲723.37 ▲0.25649.38 ▼31.7059.84 ▲6.49
Media Library /wp-admin/upload.php1,388 ▲34.18 ▼0.0194.94 ▼0.2344.48 ▲0.32

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
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 50% from 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
The following issues need your attention
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/coupon-by-roles-for-woocommerce/coupon-by-roles.php:14

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

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
7 plugin tags: wooocmmerce roles, wordpress roles, coupon by roles, woocommerce coupon by roles, wooocmmerce coupon restriction...

coupon-by-roles-for-woocommerce/coupon-by-roles.php 92% from 13 tests

This is the main PHP file of "Coupon By Roles For WooCommerce" version 0.6, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("coupon-by-roles-for-woocommerce.php" instead of "coupon-by-roles.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin122 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP33567122

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.54
Average class complexity29.00
▷ Minimum class complexity29.00
▷ Maximum class complexity29.00
Average method complexity5.00
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods7
▷ Static methods00.00%
▷ Public methods7100.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

PNG files should be compressed to save space and minimize bandwidth usage
PNG images were not found in this plugin