84% woocommerce-cart-stock-reducer

Code Review | WooCommerce Cart Stock Reducer

WordPress plugin WooCommerce Cart Stock Reducer scored84%from 54 tests.

About plugin

  • Plugin page: woocommerce-cart-...
  • Plugin version: 3.90
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.8.1
  • WordPress version: 6.3.1
  • First release: Feb 19, 2015
  • Latest release: Jun 13, 2022
  • Number of updates: 72
  • Update frequency: every 37.1 days
  • Top authors: jamesgol (100%)

Code review

54 tests

User reviews

35 reviews

Install metrics

2,000+ active /31,743 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

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

A check of server-side resources used by WooCommerce Cart Stock Reducer
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0139.29 ▼3.28
Dashboard /wp-admin3.31 ▼0.0345.47 ▼13.04
Posts /wp-admin/edit.php3.36 ▲0.0142.75 ▼5.92
Add New Post /wp-admin/post-new.php5.89 ▲0.0180.60 ▼10.33
Media Library /wp-admin/upload.php3.23 ▲0.0133.21 ▼1.44

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

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

Browser metrics Passed 4 tests

WooCommerce Cart Stock Reducer: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.71 ▼0.651.94 ▼0.0343.03 ▲0.89
Dashboard /wp-admin2,206 ▲185.82 ▼0.07104.65 ▼10.9438.28 ▼8.13
Posts /wp-admin/edit.php2,086 ▼32.00 ▼0.0133.98 ▼3.2432.49 ▲1.70
Add New Post /wp-admin/post-new.php1,533 ▼023.06 ▼0.28678.82 ▼17.0561.54 ▼6.07
Media Library /wp-admin/upload.php1,388 ▼34.21 ▲0.0293.38 ▼7.4641.10 ▼5.23

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
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/woocommerce-cart-stock-reducer/tests/test-sample.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Unit_Test_Case' not found in wp-content/plugins/woocommerce-cart-stock-reducer/tests/test-woocommerce.php:11
    • > PHP Fatal error
      Uncaught Exception: Could not find /tmp/wordpress-tests-lib/includes/functions.php, have you run bin/install-wp-tests.sh ? in wp-content/plugins/woocommerce-cart-stock-reducer/tests/bootstrap.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: cart, woocommerce, stock, countdown, expire

woocommerce-cart-stock-reducer/woocommerce-cart-stock-reducer.php Passed 13 tests

The main PHP script in "WooCommerce Cart Stock Reducer" version 3.90 is automatically included on every request by WordPress
107 characters long description:
Allow WooCommerce inventory stock to be reduced when adding items to cart and/or expire items from the cart

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin3,268 lines of code in 76 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript58776591,542
PHP82274341,232
Markdown1530162
Bourne Shell12111120
CSS22168
YAML17062
HTML10036
XML35234
JSON10012

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity54.00
▷ Minimum class complexity1.00
▷ Maximum class complexity216.00
Average method complexity4.63
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods73
▷ Static methods00.00%
▷ Public methods6690.41%
▷ Protected methods45.48%
▷ Private methods34.11%
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

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/js/jquery-countdown/img/countdownLED.png0.33KB0.27KB▼ 18.88%