10% out-of-stock-display-for-woocommerce

Code Review | Out of stock display for woocommerce

WordPress plugin Out of stock display for woocommerce scored 10% from 54 tests.

About plugin

  • Plugin page: out-of-stock-disp...
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.2.1
  • WordPress version: 5.9.2
  • First release: Mar 6, 2019
  • Latest release: Jun 3, 2019
  • Number of updates: 8
  • Update frequency: every 11.7 days
  • Top authors: johnc1979 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active / 1,574 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
You still need to fix the following installer errors
  • This plugin did not install gracefully
    • > Warning in wp-content/plugins/out-of-stock-display-for-woocommerce/out-stock-display-woocommerce-pro.php+49
    Use of undefined constant woocommerce - assumed 'woocommerce' (this will throw an Error in a future version of PHP)

Server metrics [RAM: ▲3.24MB] [CPU: ▼329.70ms] Passed 4 tests

A check of server-side resources used by Out of stock display for woocommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /7.55 ▲4.4322.30 ▼30.65
Dashboard /wp-admin7.57 ▲4.1627.39 ▼13.36
Posts /wp-admin/edit.php7.57 ▲3.9321.99 ▼21.26
Add New Post /wp-admin/post-new.php7.57 ▲0.6021.02 ▼1,253.54
Media Library /wp-admin/upload.php7.57 ▲4.2719.95 ▼7.05
Freemius Debug [v.2.2.4] /wp-admin/admin.php?page=freemius7.5722.43
Out of stock display /wp-admin/admin.php?page=out_of_stock_display_for_woocommerce_pro7.5725.51

Server storage [IO: ▲3.35MB] [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: 227 new files
Database: no new tables, 5 new options
New WordPress options
fs_accounts
fs_api_cache
fs_debug_mode
fs_gdpr
fs_active_plugins

Browser metrics Passed 4 tests

Out of stock display for woocommerce: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,960 ▲21816.60 ▲1.419.05 ▲2.852.45 ▲0.29
Dashboard /wp-admin2,948 ▲906.83 ▲0.68127.13 ▼20.20188.76 ▲22.19
Posts /wp-admin/edit.php2,753 ▲593.55 ▲0.3267.12 ▲1.67170.54 ▲24.03
Add New Post /wp-admin/post-new.php1,664 ▼9620.62 ▼1.55454.67 ▲8.36176.63 ▼8.56
Media Library /wp-admin/upload.php1,748 ▲575.79 ▲0.27136.00 ▼24.01223.32 ▲26.30
Freemius Debug [v.2.2.4] /wp-admin/admin.php?page=freemius1,4722.9255.83121.21
Out of stock display /wp-admin/admin.php?page=out_of_stock_display_for_woocommerce_pro1,2832.8759.49170.39

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-content/plugins/out-of-stock-display-for-woocommerce/out-stock-display-woocommerce-pro.php+49
    Use of undefined constant woocommerce - assumed 'woocommerce' (this will throw an Error in a future version of PHP)
  • Zombie WordPress options detected upon uninstall: 5 options
    • fs_active_plugins
    • fs_accounts
    • fs_api_cache
    • fs_gdpr
    • fs_debug_mode

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=out_of_stock_display_for_woocommerce_pro
    • > Warning in wp-content/plugins/out-of-stock-display-for-woocommerce/out-stock-display-woocommerce-pro.php+49
    Use of undefined constant woocommerce - assumed 'woocommerce' (this will throw an Error in a future version of PHP)

SRP 0% 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 take a closer look at the following
  • 3× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/out-of-stock-display-for-woocommerce/admin/partials/out-stock-display-woocommerce-pro-admin-display.php
    • > /wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/ajax-loader.php
    • > /wp-content/plugins/out-of-stock-display-for-woocommerce/public/partials/out-stock-display-woocommerce-pro-public-display.php
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/account/partials/addon.php on line 6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/account/partials/addon.php on line 8
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/account/partials/addon.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_slug() on null in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/account/partials/addon.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function freemius() in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/partials/network-activation.php:6
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/account/partials/addon.php on line 6
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/account/partials/addon.php on line 8
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/out-of-stock-display-for-woocommerce/freemius/templates/account/partials/addon.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/out-of-stock-display-for-woocommerce/public/class-out-stock-display-woocommerce-pro-public.php:110
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/out-of-stock-display-for-woocommerce/admin/class-out-stock-display-woocommerce-pro-admin.php:112

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)
No browser issues were found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Plugin Name: Please specify the plugin name on the first line ( === out-of-stock-display-for-woocommerce === )
  • Donate link: Please fix this invalid URI: ""
The official readme.txt might help

out-of-stock-display-for-woocommerce/out-stock-display-woocommerce-pro.php 85% from 13 tests

The main PHP script in "Out of stock display for woocommerce" version 1.0.1 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("out-of-stock-display-for-woocommerce.php" instead of "out-stock-display-woocommerce-pro.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis 97% from 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
Good job! No executable or dangerous file extensions detected41,605 lines of code in 174 files:
LanguageFilesBlank linesComment linesLines of code
PHP1176,39815,10726,748
PO File105,5506,66712,010
Sass28399772,515
JavaScript63988206
CSS132338126

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 2,360)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity65.37
▷ Minimum class complexity1.00
▷ Maximum class complexity2,360.00
Average method complexity4.23
▷ Minimum method complexity1.00
▷ Maximum method complexity83.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes52
▷ Abstract classes23.85%
▷ Concrete classes5096.15%
▷ Final classes00.00%
Methods1,069
▷ Static methods16815.72%
▷ Public methods75070.16%
▷ Protected methods151.40%
▷ Private methods30428.44%
Functions111
▷ Named functions111100.00%
▷ Anonymous functions00.00%
Constants117
▷ Global constants9782.91%
▷ Class constants2017.09%
▷ Public constants20100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/out-of-stock-display-for-woocommerce.png3.15KB2.85KB▼ 9.48%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%