89% allow-only-1-product-in-cart-for-woocommerce

Code Review | Allow only 1 product in Cart

WordPress plugin Allow only 1 product in Cart scored89%from 54 tests.

About plugin

  • Plugin page: allow-only-1-prod...
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Oct 4, 2019
  • Latest release: Jul 11, 2023
  • Number of updates: 6
  • Update frequency: every 229.5 days
  • Top authors: yasirkhalifa (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

500+ active /2,801 total downloads


Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.01MB] [CPU: ▼2.78ms] Passed 4 tests

This is a short check of server-side resources used by Allow only 1 product in Cart
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0137.31 ▼3.34
Dashboard /wp-admin3.31 ▲0.0147.55 ▲3.69
Posts /wp-admin/edit.php3.36 ▲0.0146.84 ▼0.96
Add New Post /wp-admin/post-new.php5.89 ▲0.0184.87 ▼8.99
Media Library /wp-admin/upload.php3.23 ▲0.0136.31 ▲2.17

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options

Browser metrics Passed 4 tests

A check of browser resources used by Allow only 1 product in Cart
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.34 ▼1.041.70 ▼0.0140.22 ▼13.65
Dashboard /wp-admin2,209 ▲215.91 ▲1.02101.23 ▼11.1241.15 ▲1.56
Posts /wp-admin/edit.php2,068 ▼212.07 ▲0.0634.01 ▼1.4531.61 ▼5.32
Add New Post /wp-admin/post-new.php1,536 ▲1723.22 ▼0.04636.08 ▼64.1153.71 ▼11.05
Media Library /wp-admin/upload.php1,382 ▼34.16 ▼0.1295.64 ▼10.4444.10 ▼1.22

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
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP Passed 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
Everything seems fine, however this is by no means an exhaustive test

User-side errors Passed 1 test

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


Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Requires at least: Version not formatted correctly
The official readme.txt is a good inspiration

allow-only-1-product-in-cart-for-woocommerce/allow-only-1-product-cart.php 85% from 13 tests

The main file in "Allow only 1 product in Cart" v. 1.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 196 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("allow-only-1-product-in-cart-for-woocommerce.php" instead of "allow-only-1-product-cart.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
No dangerous file extensions were detected20 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity3.00
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
▷ Static methods00.00%
▷ Public methods2100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
▷ Named functions00.00%
▷ Anonymous functions00.00%
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin