84% wc-give-a-coupon

Code Review | WC Give a Coupon

WordPress plugin WC Give a Coupon scored84%from 54 tests.

About plugin

  • Plugin page: wc-give-a-coupon
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jun 9, 2020
  • Latest release: Feb 7, 2021
  • Number of updates: 6
  • Update frequency: every 42.8 days
  • Top authors: ggfat (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

10+ active /430 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼6.24ms] Passed 4 tests

This is a short check of server-side resources used by WC Give a Coupon
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.43 ▼12.28
Dashboard /wp-admin3.31 ▲0.0044.05 ▼2.50
Posts /wp-admin/edit.php3.36 ▲0.0044.22 ▼1.68
Add New Post /wp-admin/post-new.php5.89 ▲0.0083.21 ▼8.51
Media Library /wp-admin/upload.php3.23 ▲0.0033.41 ▲2.44

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for WC Give a Coupon
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.61 ▼0.984.78 ▲2.9543.41 ▲1.38
Dashboard /wp-admin2,203 ▲155.83 ▲0.99100.97 ▼5.4739.29 ▼4.52
Posts /wp-admin/edit.php2,089 ▲32.00 ▼0.1233.92 ▼2.5633.50 ▼1.69
Add New Post /wp-admin/post-new.php1,514 ▼1917.44 ▼5.68667.01 ▼10.9456.91 ▲5.57
Media Library /wp-admin/upload.php1,379 ▼124.25 ▼0.0095.83 ▼7.2642.06 ▼4.38

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
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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
Please fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wc-give-a-coupon/give-automatic-coupon.php

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 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
There were not plugin tags detected

wc-give-a-coupon/give-automatic-coupon.php 85% from 13 tests

"WC Give a Coupon" version 1.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("wc-give-a-coupon.php" instead of "give-automatic-coupon.php")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin330 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP35322271
PO File1181859

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity7.00
▷ Minimum class complexity1.00
▷ Maximum class complexity18.00
Average method complexity2.20
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods15
▷ Static methods640.00%
▷ Public methods15100.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