68% default-quantity-for-woocommerce

Code Review | Default Quantity for WooCommerce

WordPress plugin Default Quantity for WooCommerce scored68%from 54 tests.

About plugin

  • Plugin page: default-quantity-...
  • Plugin version: 2.0.2
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Jul 21, 2020
  • Latest release: Jul 14, 2023
  • Number of updates: 16
  • Update frequency: every 68.1 days
  • Top authors: hossain88 (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active /2,928 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.15MB] [CPU: ▼4.79ms] Passed 4 tests

This is a short check of server-side resources used by Default Quantity for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.1039.08 ▼2.01
Dashboard /wp-admin3.51 ▲0.2152.23 ▼0.28
Posts /wp-admin/edit.php3.56 ▲0.2144.60 ▼7.09
Add New Post /wp-admin/post-new.php6.03 ▲0.1484.92 ▼8.87
Media Library /wp-admin/upload.php3.37 ▲0.1438.10 ▼1.17

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 1,796 new files
Database: no new tables, 8 new options
New WordPress options
dqfwc_version
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
dqfwc_installed
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Default Quantity for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.37 ▲0.011.77 ▼0.1942.25 ▼4.35
Dashboard /wp-admin2,192 ▲155.62 ▼0.0786.85 ▼15.9439.19 ▼4.53
Posts /wp-admin/edit.php2,100 ▼02.00 ▼0.0239.81 ▲3.7936.23 ▲1.48
Add New Post /wp-admin/post-new.php1,526 ▼022.95 ▼0.14645.82 ▼39.4558.26 ▲0.05
Media Library /wp-admin/upload.php1,400 ▲94.16 ▼0.0293.06 ▼2.4342.52 ▼3.31

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 does not fully uninstall, leaving 8 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • dqfwc_version
    • dqfwc_installed

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/default-quantity-for-woocommerce/vendor/phpcompatibility/php-compatibility/phpunit-bootstrap.php
  • 787× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Sniffs\\AbstractVariableSniff' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Classes/ClosingBraceUnitTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ScopeClosingBraceUnitTest.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer\\Sniffs\\Sniff' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/PHP/InnerFunctionsSniff.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/src/Standards/MySource/Tests/CSS/BrowserSpecificStylesUnitTest.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer\\Sniffs\\Sniff' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/Fixtures/Sniffs/Category/SetPropertyAllowedAsDeclaredSniff.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer\\Sniffs\\Sniff' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/ControlStructures/InlineIfDeclarationSniff.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer\\Sniffs\\Sniff' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/FunctionSpacingSniff.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'PHPCompatibility\\AbstractFunctionCallParameterSniff' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedIconvEncodingSniff.php:32
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/CSS/DuplicateClassDefinitionUnitTest.php:14

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 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: minimum quantity, quantity, woocommerce quantity, default, default quantity

default-quantity-for-woocommerce/default-quantity-for-woocommerce.php Passed 13 tests

The primary PHP file in "Default Quantity for WooCommerce" version 2.0.2 is used by WordPress to initiate all plugin functionality
101 characters long description:
Discover the simplest method to establish default quantities for your WooCommerce store effortlessly.

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
These items require your attention
  • Do not distribute dangerous files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/bin/phpcbf.bat
      • wp-content/plugins/default-quantity-for-woocommerce/vendor/squizlabs/php_codesniffer/bin/phpcs.bat
121,324 lines of code in 1,397 files:
LanguageFilesBlank linesComment linesLines of code
PHP97023,42245,572101,525
Pascal1333,3207,3086,808
XML1844367826,199
Markdown1079003,182
JavaScript567568592,089
JSON800716
CSS3318992665
XSD160130
DOS Batch241010

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 494)
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity16.42
▷ Minimum class complexity1.00
▷ Maximum class complexity740.00
Average method complexity5.92
▷ Minimum method complexity1.00
▷ Maximum method complexity494.00
Code structure
Namespaces197
Interfaces3
Traits1
Classes814
▷ Abstract classes202.46%
▷ Concrete classes79497.54%
▷ Final classes20.25%
Methods2,589
▷ Static methods1013.90%
▷ Public methods2,13882.58%
▷ Protected methods37114.33%
▷ Private methods803.09%
Functions17
▷ Named functions211.76%
▷ Anonymous functions1588.24%
Constants162
▷ Global constants12778.40%
▷ Class constants3521.60%
▷ Public constants35100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There are no PNG files in this plugin