89% tt-discount-option-for-woocommerce

Code Review | TT Discount Option for WooCommerce

WordPress plugin TT Discount Option for WooCommerce scored89%from 54 tests.

About plugin

  • Plugin page: tt-discount-optio...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Dec 8, 2022
  • Latest release: Dec 9, 2022
  • Number of updates: 2
  • Update frequency: every 0.5 days
  • Top authors: terrytsang (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /121 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼7.81ms] Passed 4 tests

Server-side resources used by TT Discount Option for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0643.75 ▼0.69
Dashboard /wp-admin3.36 ▲0.0651.50 ▼1.27
Posts /wp-admin/edit.php3.41 ▲0.0644.40 ▼12.48
Add New Post /wp-admin/post-new.php5.94 ▲0.0685.67 ▼16.81
Media Library /wp-admin/upload.php3.28 ▲0.0640.72 ▲2.64

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for TT Discount Option for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.38 ▼0.201.60 ▼0.3443.86 ▲2.76
Dashboard /wp-admin2,195 ▲185.56 ▼0.0695.47 ▲6.9241.98 ▲1.12
Posts /wp-admin/edit.php2,103 ▲62.01 ▼0.0236.33 ▲1.2832.40 ▼3.70
Add New Post /wp-admin/post-new.php1,526 ▼023.51 ▲0.34657.84 ▼61.6952.22 ▼12.83
Media Library /wp-admin/upload.php1,403 ▲34.21 ▲0.0694.44 ▼20.2543.82 ▼7.53

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

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

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

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Plugin Name: Please specify the plugin name on the first line ( === tt-discount-option-for-woocommerce === )
  • Screenshots: These screenshots have no corresponding images in /assets: #1 ([screenshot-1.png] Admin WooCommerce Settings - Discount Option), #2 ([screenshot-2.png] Admin WooCommerce Settings - Discount Option (Availability)), #3 ([screenshot-3.png] Checkout Page with Discount Row)
You can look at the official readme.txt

tt-discount-option-for-woocommerce/wc-discount-option.php 92% from 13 tests

The principal PHP file in "TT Discount Option for WooCommerce" v. 1.0.0 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("tt-discount-option-for-woocommerce.php" instead of "wc-discount-option.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin1,263 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
CSS36783811
PHP18450349
PO File23232103

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity42.00
▷ Minimum class complexity42.00
▷ Maximum class complexity42.00
Average method complexity6.86
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods7
▷ Static methods00.00%
▷ Public methods7100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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
28 PNG files occupy 0.39MB with 0.20MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon-woocommerce-donation-checkout.png9.24KB4.20KB▼ 54.56%
assets/css/images/ui-icons_454545_256x240.png6.83KB4.17KB▼ 38.86%
assets/images/icon-woocommerce-product-badge.png8.45KB4.08KB▼ 51.70%
assets/images/icon-woocommerce-add-to-cart-buy-now.png8.33KB3.56KB▼ 57.30%
assets/images/icon-woocommerce-custom-checkout.png7.52KB3.75KB▼ 50.08%