84% wc-restrict-stock

Code Review | Restrict Stock for WooCommerce

WordPress plugin Restrict Stock for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: wc-restrict-stock
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.6.1
  • WordPress version: 6.3.1
  • First release: Feb 24, 2021
  • Latest release: Feb 24, 2021
  • Number of updates: 3
  • Update frequency: every 0.3 days
  • Top authors: ewich (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /310 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼2.95ms] Passed 4 tests

A check of server-side resources used by Restrict Stock for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0341.62 ▲2.75
Dashboard /wp-admin3.33 ▲0.0248.98 ▲1.34
Posts /wp-admin/edit.php3.38 ▲0.0250.47 ▲0.23
Add New Post /wp-admin/post-new.php5.93 ▲0.0495.59 ▼16.12
Media Library /wp-admin/upload.php3.25 ▲0.0240.47 ▲4.33

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 22 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
db_upgraded
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Restrict Stock for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,901 ▲11513.46 ▼0.837.94 ▲5.7238.87 ▲0.81
Dashboard /wp-admin2,199 ▲215.58 ▼0.0790.89 ▼15.2939.14 ▼1.40
Posts /wp-admin/edit.php2,107 ▲102.02 ▲0.0838.58 ▼0.3237.57 ▲2.24
Add New Post /wp-admin/post-new.php1,530 ▲223.88 ▲0.65648.37 ▼59.1355.02 ▲0.72
Media Library /wp-admin/upload.php1,404 ▲74.19 ▲0.0997.23 ▼8.3744.57 ▲1.14

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not 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
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/wc-restrict-stock/admin/partials/wc-restrict-stock-admin-display.php
    • > /wp-content/plugins/wc-restrict-stock/public/partials/wc-restrict-stock-public-display.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

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
4 plugin tags: restrict, quantity, woocommerce, products

wc-restrict-stock/wc-restrict-stock.php Passed 13 tests

This is the main PHP file of "Restrict Stock for WooCommerce" version 1.0.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
123 characters long description:
A small extension written to make it possible to restrict quantities of stock purchased in a single order with WooCommerce.

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
There were no executable files found in this plugin304 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP12142554298
JavaScript24546
CSS2080

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity4.14
▷ Minimum class complexity1.00
▷ Maximum class complexity18.00
Average method complexity1.67
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods33
▷ Static methods26.06%
▷ Public methods2884.85%
▷ Protected methods00.00%
▷ Private methods515.15%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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 were not PNG files found in your plugin