10% auto-generate-coupon-for-woocommerce

Code Review | Auto generate coupon for Woocommerce

WordPress plugin Auto generate coupon for Woocommercescored10%from 54 tests.

About plugin

  • Plugin page: auto-generate-cou...
  • Plugin version: 1.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.9.3
  • WordPress version: 6.3.1
  • First release: Apr 29, 2022
  • Latest release: May 5, 2022
  • Number of updates: 4
  • Update frequency: every 0.3 days
  • Top authors: ghourbaniansaeed (100%)Otto42 (50%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /299 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Please fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Notice in wp-content/plugins/auto-generate-coupon-for-woocommerce/includes/core-functions.php+14
    Undefined index: active_campaign

Server metrics [RAM: ▼1.89MB] [CPU: ▼45.95ms] Passed 4 tests

A check of server-side resources used by Auto generate coupon for Woocommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.06 ▼1.4011.13 ▼24.08
Dashboard /wp-admin2.13 ▼1.186.78 ▼39.39
Posts /wp-admin/edit.php2.13 ▼1.237.62 ▼37.38
Add New Post /wp-admin/post-new.php2.13 ▼3.766.46 ▼78.91
Media Library /wp-admin/upload.php2.13 ▼1.106.63 ▼28.13
Auto generate coupon for Woocommerce /wp-admin/admin.php?page=auto_generate_coupon2.137.10

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 22 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

Auto generate coupon for Woocommerce: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,791 ▲3014.35 ▲0.021.70 ▼0.2443.29 ▲0.06
Dashboard /wp-admin2,194 ▲205.52 ▼0.1583.63 ▼2.7738.15 ▼8.67
Posts /wp-admin/edit.php2,102 ▲22.04 ▲0.0734.55 ▲0.3930.30 ▼9.68
Add New Post /wp-admin/post-new.php1,528 ▼723.67 ▲5.34676.19 ▲29.5150.37 ▼25.90
Media Library /wp-admin/upload.php1,399 ▼14.23 ▲0.0798.36 ▼6.7539.69 ▼2.80
Auto generate coupon for Woocommerce /wp-admin/admin.php?page=auto_generate_coupon8821.6729.8328.02

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/auto-generate-coupon-for-woocommerce/includes/core-functions.php+14
    Undefined index: active_campaign
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=auto_generate_coupon
    • > Notice in wp-content/plugins/auto-generate-coupon-for-woocommerce/includes/core-functions.php+14
    Undefined index: active_campaign
    • > GET request to /wp-admin/admin.php?page=auto_generate_coupon
    • > User notice in wp-includes/functions.php+5905
    Function add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be numeric representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.)

SRP Passed 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The SRP test was a success

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=auto_generate_coupon
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).datepicker is not a function" "TypeError: jQuery(...).datepicker is not a function\n at HTMLDocument.\u003Canonymous> (/wp-admin/admin.php?page=auto_generate_coupon:153:73)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=auto_generate_coupon
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: jQuery(...).datepicker is not a function

Optimizations

Plugin configuration 86% 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:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === Auto generate coupon for Woocommerce=== )
Please take inspiration from this readme.txt

auto-generate-coupon-for-woocommerce/auto_generate_coupon_for_woocommerce.php 77% from 13 tests

"Auto generate coupon for Woocommerce" version 1.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Requires at least: Required version must match the one declared in readme.txt ("3.0.1" instead of "4.5")
  • Text Domain: The text domain should only use lowercase characters and dashes
  • Main file name: Name the main plugin file the same as the plugin slug ("auto-generate-coupon-for-woocommerce.php" instead of "auto_generate_coupon_for_woocommerce.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin811 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
CSS34465446
PHP1112742299
PO File1202266

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity2.00
▷ Minimum class complexity2.00
▷ Maximum class complexity2.00
Average method complexity2.00
▷ Minimum method complexity2.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods1
▷ Static methods1100.00%
▷ Public methods1100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions17
▷ Named functions17100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG files were detected