87% add-coupon-by-link-for-woocommerce

Code Review | Add coupon by link / URL coupons for Woocommerce

WordPress plugin Add coupon by link / URL coupons for Woocommerce scored 87% from 54 tests.

About plugin

  • Plugin page: add-coupon-by-lin...
  • Plugin version: 1.0.27
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.9.2
  • WordPress version: 5.9.2
  • First release: Jul 24, 2021
  • Latest release: Apr 5, 2022
  • Number of updates: 24
  • Update frequency: every 10.7 days
  • Top authors: rajeshsingh520 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 713 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▼0.02MB] [CPU: ▼298.53ms] Passed 4 tests

A check of server-side resources used by Add coupon by link / URL coupons for Woocommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0278.06 ▼0.57
Dashboard /wp-admin3.42 ▲0.0143.56 ▲2.19
Posts /wp-admin/edit.php3.65 ▲0.0045.81 ▼28.23
Add New Post /wp-admin/post-new.php6.89 ▼0.08117.35 ▼1,157.69
Media Library /wp-admin/upload.php3.30 ▲0.0135.05 ▼7.64

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 41 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Add coupon by link / URL coupons for Woocommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,831 ▲10515.94 ▲0.457.88 ▼1.493.57 ▼0.45
Dashboard /wp-admin2,924 ▲456.38 ▼0.03199.37 ▼13.84198.35 ▼30.60
Posts /wp-admin/edit.php2,698 ▲73.43 ▲0.0179.67 ▼3.89174.32 ▼6.33
Add New Post /wp-admin/post-new.php1,641 ▲2517.31 ▲0.43617.85 ▼55.92200.56 ▼26.04
Media Library /wp-admin/upload.php1,707 ▲95.68 ▼0.02185.32 ▼1.55249.89 ▼18.49

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/add-coupon-by-link-for-woocommerce/includes/pisol.class.form.php
  • 8× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/add-coupon-by-link-for-woocommerce/public/notice.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-coupon-by-link-for-woocommerce/admin/coupon-options.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/add-coupon-by-link-for-woocommerce/includes/includes.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function pisol_acblw_get_option() in wp-content/plugins/add-coupon-by-link-for-woocommerce/public/session.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/add-coupon-by-link-for-woocommerce/admin/plugins.php:92
    • > PHP Fatal error
      Uncaught Error: Call to undefined function pisol_acblw_get_option() in wp-content/plugins/add-coupon-by-link-for-woocommerce/public/apply-coupon.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-coupon-by-link-for-woocommerce/public/add-product.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/add-coupon-by-link-for-woocommerce/admin/option.php:104

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention: The official readme.txt is a good inspiration

add-coupon-by-link-for-woocommerce/add-coupon-by-link-woocommerce.php 85% from 13 tests

The main PHP file in "Add coupon by link / URL coupons for Woocommerce" ver. 1.0.27 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("add-coupon-by-link-for-woocommerce.php" instead of "add-coupon-by-link-woocommerce.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

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 plugin10,753 lines of code in 35 files:
LanguageFilesBlank linesComment linesLines of code
CSS32,022189,259
PHP273514231,044
SVG322444
JavaScript24546

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity8.67
▷ Minimum class complexity1.00
▷ Maximum class complexity66.00
Average method complexity2.77
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes00.00%
▷ Concrete classes18100.00%
▷ Final classes00.00%
Methods79
▷ Static methods67.59%
▷ Public methods7493.67%
▷ Protected methods00.00%
▷ Private methods56.33%
Functions8
▷ Named functions675.00%
▷ Anonymous functions225.00%
Constants1
▷ Global constants1100.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
PNG images were not found in this plugin