89% coupon-generator-for-woocommerce

Code Review | Coupon Generator for WooCommerce

WordPress plugin Coupon Generator for WooCommerce scored89%from 54 tests.

About plugin

  • Plugin page: coupon-generator-...
  • Plugin version: 1.2.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.0-6.0
  • WordPress version: 6.3.1
  • First release: Sep 30, 2015
  • Latest release: Jun 6, 2022
  • Number of updates: 25
  • Update frequency: every 98.8 days
  • Top authors: sormano (100%)

Code review

54 tests

User reviews

31 reviews

Install metrics

10,000+ active /91,261 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

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

Server-side resources used by Coupon Generator for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0035.61 ▼3.27
Dashboard /wp-admin3.31 ▲0.0044.56 ▼5.50
Posts /wp-admin/edit.php3.36 ▲0.0048.26 ▲2.49
Add New Post /wp-admin/post-new.php5.89 ▲0.0089.02 ▼8.60
Media Library /wp-admin/upload.php3.23 ▲0.0033.59 ▼0.32

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 18 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Coupon Generator for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.19 ▼1.095.05 ▲3.2439.88 ▼3.95
Dashboard /wp-admin2,209 ▲215.86 ▲0.05106.08 ▲1.7540.26 ▼3.95
Posts /wp-admin/edit.php2,089 ▼01.99 ▲0.0140.18 ▲3.7535.10 ▲1.54
Add New Post /wp-admin/post-new.php1,529 ▲1518.25 ▲0.73606.48 ▼83.3252.78 ▲2.25
Media Library /wp-admin/upload.php1,382 ▼34.27 ▲0.0895.57 ▼7.1241.85 ▲0.89

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
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

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)
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Please fix the following attributes:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Start of generating coupons), #2 (Coupon options), #3 (Generation options), #4 (Generating coupons), #5 (Generated coupons)
You can take inspiration from this readme.txt

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

The main PHP file in "Coupon Generator for WooCommerce" ver. 1.2.0 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: It is recommended to name the main PHP file as the plugin slug ("coupon-generator-for-woocommerce.php" instead of "woocommerce-coupon-generator.php")

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
There were no executable files found in this plugin671 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP8173321451
Sass1241165
JavaScript215054
CSS1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity7.67
▷ Minimum class complexity5.00
▷ Maximum class complexity12.00
Average method complexity2.05
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods19
▷ Static methods15.26%
▷ Public methods19100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.54MB with 0.39MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png120.19KB34.54KB▼ 71.27%
screenshot-1.png121.00KB33.79KB▼ 72.07%
screenshot-4.png96.35KB26.01KB▼ 73.00%
screenshot-3.png86.78KB24.27KB▼ 72.03%
screenshot-5.png133.75KB39.76KB▼ 70.27%