73% sold-out-badge-for-woocommerce

Code Review | Sold Out Badge for WooCommerce

WordPress plugin Sold Out Badge for WooCommerce scored73%from 54 tests.

About plugin

  • Plugin page: sold-out-badge-fo...
  • Plugin version: 4.4.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.2
  • WordPress version: 6.3.1
  • First release: Oct 30, 2020
  • Latest release: May 30, 2023
  • Number of updates: 32
  • Update frequency: every 29.5 days
  • Top authors: charlieetienne (100%)

Code review

54 tests

User reviews

22 reviews

Install metrics

10,000+ active /94,306 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲1.54MB] [CPU: ▲4.22ms] Passed 4 tests

An overview of server-side resources used by Sold Out Badge for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /5.06 ▲1.6061.47 ▲22.64
Dashboard /wp-admin4.85 ▲1.5157.13 ▼4.24
Posts /wp-admin/edit.php4.93 ▲1.5863.80 ▲16.57
Add New Post /wp-admin/post-new.php7.44 ▲1.5689.89 ▼6.86
Media Library /wp-admin/upload.php4.75 ▲1.5246.72 ▲11.40
Sold Out Badge for WooCommerce /wp-admin/options-general.php?page=wcsob4.8150.87

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 471 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Sold Out Badge for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,971 ▲22518.62 ▲4.411.57 ▼0.3036.18 ▼5.43
Dashboard /wp-admin2,370 ▲1829.29 ▲4.42226.91 ▲120.7744.82 ▲2.06
Posts /wp-admin/edit.php2,294 ▲2056.26 ▲4.2589.68 ▲51.4636.07 ▲0.90
Add New Post /wp-admin/post-new.php1,580 ▲5719.88 ▼3.46731.36 ▲44.4039.33 ▼16.48
Media Library /wp-admin/upload.php1,421 ▲396.68 ▲2.42115.76 ▲4.2442.50 ▼7.39
Sold Out Badge for WooCommerce /wp-admin/options-general.php?page=wcsob1,4747.87139.9941.29

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
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/templates/Exception/incorrect-syntax.php
  • 117× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/templates/Container/user_meta.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Field\\Field' not found in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/core/Field/Oembed_Field.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\Condition' not found in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/core/Container/Condition/User_Capability_Condition.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Container' not found in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/core/Container/Theme_Options_Container.php:11
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/templates/Container/post_meta.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Field\\Field' not found in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/core/Field/Date_Field.php:8
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/templates/Exception/incorrect-syntax.php on line 35
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\Condition' not found in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/core/Container/Condition/Post_Format_Condition.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Fulfillable\\Translator\\Array_Translator' not found in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/core/Container/Fulfillable/Translator/Json_Translator.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\Condition' not found in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/core/Container/Condition/Post_Type_Condition.php:8

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
These are user-side errors you should fix
    • > GET request to /wp-admin/options-general.php?page=wcsob
    • > Console-api (warning) in wp-content/plugins/sold-out-badge-for-woocommerce/vendor/htmlburger/carbon-fields/build/classic/vendor.min.js?ver=3.6.0+48:54975
    wp.compose.withState is deprecated since version 5.8. Please use wp.element.useState instead.

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: sold out, out of stock, badge, wcsob, woocommerce

sold-out-badge-for-woocommerce/sold-out-badge-for-woocommerce.php Passed 13 tests

The main file in "Sold Out Badge for WooCommerce" v. 4.4.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
52 characters long description:
Display a "Sold Out!" badge on out-of-stock products

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected32,298 lines of code in 416 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1677,07810,87215,944
PHP1602,7117,0629,606
PO File299091,1242,449
CSS82401,1572,229
Sass4936531,868
JSON100149
Markdown215053

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity8.46
▷ Minimum class complexity1.00
▷ Maximum class complexity50.00
Average method complexity2.08
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces25
Interfaces5
Traits0
Classes135
▷ Abstract classes118.15%
▷ Concrete classes12491.85%
▷ Final classes21.61%
Methods973
▷ Static methods14414.80%
▷ Public methods80382.53%
▷ Protected methods16516.96%
▷ Private methods50.51%
Functions104
▷ Named functions2120.19%
▷ Anonymous functions8379.81%
Constants33
▷ Global constants824.24%
▷ Class constants2575.76%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

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