84% restriction-on-cart

Code Review | Restriction on Cart

WordPress plugin Restriction on Cart scored84%from 54 tests.

About plugin

  • Plugin page: restriction-on-cart
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.9
  • WordPress version: 6.3.1
  • First release: Feb 23, 2022
  • Latest release: Feb 23, 2022
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: ondway2legend (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /233 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

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

An overview of server-side resources used by Restriction on Cart
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0137.91 ▼2.24
Dashboard /wp-admin3.31 ▲0.0144.11 ▼8.83
Posts /wp-admin/edit.php3.36 ▲0.0043.80 ▼2.29
Add New Post /wp-admin/post-new.php5.89 ▲0.0080.89 ▼7.95
Media Library /wp-admin/upload.php3.23 ▲0.0035.22 ▼0.91
Restriction on Cart /wp-admin/options-general.php?page=functions3.2030.61

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Restriction on Cart
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6913.19 ▼1.211.64 ▼0.0941.62 ▼2.01
Dashboard /wp-admin2,213 ▲254.88 ▼0.06104.54 ▲1.2640.55 ▼0.02
Posts /wp-admin/edit.php2,090 ▲12.02 ▼0.0434.13 ▼4.8831.58 ▲1.29
Add New Post /wp-admin/post-new.php1,536 ▲323.30 ▲0.03647.23 ▼24.8253.77 ▼0.05
Media Library /wp-admin/upload.php1,386 ▼24.28 ▲0.0593.48 ▼11.8942.04 ▲0.68
Restriction on Cart /wp-admin/options-general.php?page=functions7942.0323.8725.57

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • 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 no errors were found, this is by no means an exhaustive test

SRP 50% 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
Please fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/restriction-on-cart/restriction_on_cart.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 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
5 plugin tags: cart, max items, max amount, checkout, restriction on cart

restriction-on-cart/restriction_on_cart.php 85% from 13 tests

The entry point to "Restriction on Cart" version 1.0 is a PHP file that has certain tags in its header comment area
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 ("restriction-on-cart.php" instead of "restriction_on_cart.php")
  • Description: Keep the plugin description shorter than 140 characters (currently 150 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected57 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1181757

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.57
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%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
PNG images were not found in this plugin