78% stock-locations-for-woocommerce

Code Review | Stock Locations for WooCommerce

WordPress plugin Stock Locations for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: stock-locations-f...
  • Plugin version: 2.5.9
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.4
  • WordPress version: 6.3.1
  • First release: Feb 11, 2020
  • Latest release: Nov 22, 2023
  • Number of updates: 147
  • Update frequency: every 9.5 days
  • Top authors: fahadmahmood (81.63%)alexmigf (19.05%)

Code review

54 tests

User reviews

51 reviews

Install metrics

1,000+ active /60,234 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: ▼1.25ms] Passed 4 tests

Server-side resources used by Stock Locations for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0036.92 ▼3.48
Dashboard /wp-admin3.31 ▲0.0053.83 ▲1.30
Posts /wp-admin/edit.php3.36 ▲0.0050.44 ▲0.81
Add New Post /wp-admin/post-new.php5.89 ▲0.0094.95 ▼2.03
Media Library /wp-admin/upload.php3.23 ▲0.0035.86 ▼0.28

Server storage [IO: ▲6.50MB] [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: 114 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Stock Locations for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.22 ▼0.431.67 ▼0.1040.34 ▼5.35
Dashboard /wp-admin2,195 ▲185.60 ▼0.0791.89 ▼2.9539.93 ▼6.03
Posts /wp-admin/edit.php2,100 ▼32.15 ▲0.1539.59 ▲0.4235.67 ▲0.28
Add New Post /wp-admin/post-new.php1,526 ▼323.08 ▼0.11599.20 ▼4.9251.30 ▼3.05
Media Library /wp-admin/upload.php1,391 ▼94.22 ▲0.07100.33 ▲2.6941.02 ▼3.20

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 50% 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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/stock-locations-for-woocommerce/views/product-pre-select-location-scripts.php
  • 9× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SLW\\SRC\\Helpers\\wc_slw_logger() in wp-content/plugins/stock-locations-for-woocommerce/views/settings-logger.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/stock-locations-for-woocommerce/views/taxonomy-fields-new.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/stock-locations-for-woocommerce/inc/addons.php:108
    • > PHP Notice
      Undefined variable: locations in wp-content/plugins/stock-locations-for-woocommerce/views/product-pre-select-location-scripts.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/stock-locations-for-woocommerce/inc/functions-api.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/stock-locations-for-woocommerce/views/taxonomy-fields-edit.php:1
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/stock-locations-for-woocommerce/views/product-pre-select-location-scripts.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/stock-locations-for-woocommerce/views/addons/import-export.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/stock-locations-for-woocommerce/inc/filter-hooks.php:3

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 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed: You can take inspiration from this readme.txt

stock-locations-for-woocommerce/stock-locations-for-woocommerce.php Passed 13 tests

The entry point to "Stock Locations for WooCommerce" version 2.5.9 is a PHP file that has certain tags in its header comment area
82 characters long description:
This plugin will help you to manage WooCommerce Products stocks through locations.

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
No dangerous file extensions were detected18,440 lines of code in 86 files:
LanguageFilesBlank linesComment linesLines of code
SVG4009,553
PHP552,1711,7666,367
JavaScript13357871,259
CSS867191,231
XML40016
JSON20014

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity32.68
▷ Minimum class complexity1.00
▷ Maximum class complexity142.00
Average method complexity5.97
▷ Minimum method complexity1.00
▷ Maximum method complexity45.00
Code structure
Namespaces6
Interfaces0
Traits6
Classes25
▷ Abstract classes00.00%
▷ Concrete classes25100.00%
▷ Final classes00.00%
Methods198
▷ Static methods4020.20%
▷ Public methods19196.46%
▷ Protected methods21.01%
▷ Private methods52.53%
Functions53
▷ Named functions4686.79%
▷ Anonymous functions713.21%
Constants10
▷ Global constants880.00%
▷ Class constants220.00%
▷ Public constants2100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
6 PNG files occupy 1.36MB with 0.58MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/icons/map-icon.png0.80KB0.78KB▼ 2.21%
images/slw-map-popup-thumb.png82.59KB39.09KB▼ 52.67%
images/star.png2.97KB1.78KB▼ 40.11%
images/slw-location-popup-thumb.png183.32KB80.80KB▼ 55.93%
images/slw-archives-thumb.png846.78KB324.34KB▼ 61.70%