84% woo-allow-only-one-item-in-cart

Code Review | WooCommerce - Allow Only One Item in Cart

WordPress plugin WooCommerce - Allow Only One Item in Cart scored84%from 54 tests.

About plugin

  • Plugin page: woo-allow-only-on...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-4.9.8
  • WordPress version: 6.3.1
  • First release: Sep 14, 2018
  • Latest release: Sep 14, 2018
  • Number of updates: 2
  • Update frequency: every 10.5 days
  • Top authors: mjaschen (100%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active /726 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 successfully, without throwing any errors or notices

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

An overview of server-side resources used by WooCommerce - Allow Only One Item in Cart
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0039.47 ▼4.19
Dashboard /wp-admin3.31 ▲0.0146.72 ▼4.42
Posts /wp-admin/edit.php3.36 ▲0.0053.83 ▲6.65
Add New Post /wp-admin/post-new.php5.89 ▲0.0092.39 ▼8.40
Media Library /wp-admin/upload.php3.24 ▲0.0033.21 ▼5.96

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

WooCommerce - Allow Only One Item in Cart: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7913.31 ▼1.071.80 ▲0.0740.66 ▼1.63
Dashboard /wp-admin2,206 ▲215.85 ▼0.05107.85 ▼7.5945.12 ▼0.94
Posts /wp-admin/edit.php2,092 ▲212.04 ▲0.0253.27 ▲17.7747.80 ▲15.98
Add New Post /wp-admin/post-new.php1,533 ▼1023.16 ▲5.19637.43 ▼9.7953.27 ▲1.56
Media Library /wp-admin/upload.php1,388 ▼04.18 ▲0.0094.47 ▼15.9941.73 ▼7.63

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
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting 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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/woo-allow-only-one-item-in-cart/woo-allow-only-one-item-in-cart.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
3 plugin tags: cart, woocommerce, item

woo-allow-only-one-item-in-cart/woo-allow-only-one-item-in-cart.php Passed 13 tests

The entry point to "WooCommerce - Allow Only One Item in Cart" version 1.0.0 is a PHP file that has certain tags in its header comment area
57 characters long description:
Removes all items from cart before another item is added.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected11 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP13911

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.00
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%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ 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
There are no PNG files in this plugin