83% custom-discount-on-cart-total

Code Review | Custom Discount on Cart Total

WordPress plugin Custom Discount on Cart Total scored83%from 54 tests.

About plugin

  • Plugin page: custom-discount-o...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.1
  • WordPress version: 6.3.1
  • First release: Mar 15, 2023
  • Latest release: Mar 15, 2023
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: beeplugindev (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /198 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.02MB] [CPU: ▼5.51ms] Passed 4 tests

An overview of server-side resources used by Custom Discount on Cart Total
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0242.30 ▼3.81
Dashboard /wp-admin3.32 ▲0.0251.01 ▼0.11
Posts /wp-admin/edit.php3.37 ▲0.0250.13 ▲1.16
Add New Post /wp-admin/post-new.php5.90 ▲0.0282.68 ▼19.28
Media Library /wp-admin/upload.php3.25 ▲0.0240.13 ▲7.35

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Custom Discount on Cart Total
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲5314.72 ▼0.002.12 ▲0.0044.08 ▼15.73
Dashboard /wp-admin2,195 ▲215.66 ▲0.0091.63 ▼38.7240.09 ▼13.02
Posts /wp-admin/edit.php2,103 ▲31.94 ▼0.0635.84 ▼4.7631.62 ▼6.33
Add New Post /wp-admin/post-new.php1,528 ▲223.20 ▲0.12694.32 ▲4.5956.54 ▼1.30
Media Library /wp-admin/upload.php1,400 ▼04.23 ▲0.16113.20 ▼1.3149.52 ▲2.27

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 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
Please fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-discount-on-cart-total/bee-cart-total-discount.php:11

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Screenshots: Please add images for these screenshots: #1 (screenshots-1.png), #2 (screenshots-2.png)
  • Screenshots: These screenshots need descriptions #0, #0 in custom-discount-on-cart-total/assets to your readme.txt
The official readme.txt is a good inspiration

custom-discount-on-cart-total/bee-cart-total-discount.php 92% from 13 tests

"Custom Discount on Cart Total" version 1.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("custom-discount-on-cart-total.php" instead of "bee-cart-total-discount.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
No dangerous file extensions were detected72 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP2111672

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.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 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