78% wt-smart-coupons-for-woocommerce

Code Review | Smart Coupons For WooCommerce Coupons

WordPress plugin Smart Coupons For WooCommerce Coupons scored78%from 54 tests.

About plugin

  • Plugin page: wt-smart-coupons-...
  • Plugin version: 1.5.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-6.4
  • WordPress version: 6.3.1
  • First release: Jul 31, 2018
  • Latest release: Nov 20, 2023
  • Number of updates: 71
  • Update frequency: every 27.3 days
  • Top authors: webtoffee (100%)

Code review

54 tests

User reviews

81 reviews

Install metrics

30,000+ active /407,690 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

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

An overview of server-side resources used by Smart Coupons For WooCommerce Coupons
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0035.48 ▼6.38
Dashboard /wp-admin3.31 ▲0.0147.32 ▼1.92
Posts /wp-admin/edit.php3.36 ▲0.0048.38 ▲5.07
Add New Post /wp-admin/post-new.php5.89 ▲0.0093.04 ▲9.48
Media Library /wp-admin/upload.php3.23 ▲0.0035.51 ▲1.18

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

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

Browser metrics Passed 4 tests

Smart Coupons For WooCommerce Coupons: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.27 ▲0.091.57 ▼0.1937.33 ▼6.71
Dashboard /wp-admin2,195 ▲155.55 ▼0.1298.95 ▲1.6342.35 ▼4.03
Posts /wp-admin/edit.php2,103 ▲61.94 ▼0.0640.55 ▲3.5634.82 ▼0.42
Add New Post /wp-admin/post-new.php1,526 ▼023.54 ▲0.46681.51 ▲49.1956.07 ▲2.78
Media Library /wp-admin/upload.php1,403 ▲94.21 ▲0.0295.10 ▼1.0542.71 ▲2.21

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
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% 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)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 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
The following issues need your attention
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/wt-smart-coupons-for-woocommerce/common/modules/coupon_style/data/data.template_stitched_padding.php
    • > /wp-content/plugins/wt-smart-coupons-for-woocommerce/common/modules/coupon_style/data/data.template_default.php
    • > /wp-content/plugins/wt-smart-coupons-for-woocommerce/public/templates/wt-smart-coupon-public-display.php
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wt-smart-coupons-for-woocommerce/includes/class-wt-smartcoupon-uninstall-feedback.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/wt-smart-coupons-for-woocommerce/admin/views/general_settings.php:14

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Tags: You are using too many tags: 15 tag instead of maximum 10
You can look at the official readme.txt

wt-smart-coupons-for-woocommerce/wt-smart-coupon.php 85% from 13 tests

The main PHP file in "Smart Coupons For WooCommerce Coupons" ver. 1.5.2 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("wt-smart-coupons-for-woocommerce.php" instead of "wt-smart-coupon.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 142 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin27,540 lines of code in 122 files:
LanguageFilesBlank linesComment linesLines of code
PO File94,8777,83414,068
PHP692,1473,03210,570
JavaScript142161302,118
CSS86765588
SVG2200196

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity33.59
▷ Minimum class complexity1.00
▷ Maximum class complexity260.00
Average method complexity4.16
▷ Minimum method complexity1.00
▷ Maximum method complexity88.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes39
▷ Abstract classes00.00%
▷ Concrete classes39100.00%
▷ Final classes00.00%
Methods402
▷ Static methods13333.08%
▷ Public methods35287.56%
▷ Protected methods41.00%
▷ Private methods4611.44%
Functions6
▷ Named functions583.33%
▷ Anonymous functions116.67%
Constants10
▷ Global constants990.00%
▷ Class constants110.00%
▷ Public constants1100.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
32 PNG files occupy 0.45MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/modules/freevspro/assets/images/tick_icon_green.png6.63KB0.38KB▼ 94.27%
admin/modules/other_solutions/assets/images/wt_al_logo.png4.30KB2.71KB▼ 37.06%
admin/modules/other_solutions/assets/images/stripe-plugin.png21.80KB21.54KB▼ 1.16%
admin/modules/other_solutions/assets/images/url-coupons-plugin.png19.84KB19.59KB▼ 1.26%
admin/modules/other_solutions/assets/images/bulk_generate.png48.72KB16.54KB▼ 66.04%