67% foosales

Code Review | FooSales — Point of Sale (POS) for WooCommerce

WordPress plugin FooSales — Point of Sale (POS) for WooCommerce scored67%from 54 tests.

About plugin

  • Plugin page: foosales
  • Plugin version: 1.37.3
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6.0-6.3.2
  • WordPress version: 6.3.1
  • First release: Sep 20, 2017
  • Latest release: Oct 18, 2023
  • Number of updates: 116
  • Update frequency: every 19.2 days
  • Top authors: foosales (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

700+ active /51,512 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.48MB] [CPU: ▲8.33ms] 75% from 4 tests

An overview of server-side resources used by FooSales — Point of Sale (POS) for WooCommerce
Please have a look at the following items
  • CPU: Total CPU usage must kept under 500.00ms (currently 3,198.81ms on /wp-admin/admin.php?page=foosales-settings)
PageMemory (MB)CPU Time (ms)
Home /4.90 ▲1.4445.19 ▲5.55
Dashboard /wp-admin4.83 ▲1.4857.21 ▼0.23
Posts /wp-admin/edit.php4.84 ▲1.4861.38 ▲13.70
Add New Post /wp-admin/post-new.php7.48 ▲1.59111.67 ▲14.30
Media Library /wp-admin/upload.php4.75 ▲1.5251.12 ▲17.01
Settings /wp-admin/admin.php?page=foosales-settings4.703,198.81
Import /wp-admin/admin.php?page=foosales-import4.5942.82

Server storage [IO: ▲7.31MB] [DB: ▲0.01MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 382 new files
Database: 3 new tables, 14 new options
New tables
wp_foosales_square_devices
wp_foosales_square_refunds
wp_foosales_square_checkouts
New WordPress options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
foosales_db_square_devices
recovery_mode_email_last_sent
globalFooSalesSalt
foosales_db_square_refunds
can_compress_scripts
foosales_db_square_checkouts
globalFooSalesAnalyticsOptIn
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for FooSales — Point of Sale (POS) for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,863 ▲11713.56 ▼0.795.56 ▲4.0738.21 ▼2.18
Dashboard /wp-admin2,269 ▲885.76 ▲0.1091.54 ▼9.9637.89 ▼6.43
Posts /wp-admin/edit.php2,174 ▲742.27 ▲0.2539.95 ▲4.7735.99 ▼4.36
Add New Post /wp-admin/post-new.php1,568 ▲4023.48 ▲0.31623.81 ▼48.0458.76 ▲5.59
Media Library /wp-admin/upload.php1,469 ▲724.33 ▲0.1498.90 ▼1.8041.68 ▼1.80
Settings /wp-admin/admin.php?page=foosales-settings7411.5210.9423.25
Import /wp-admin/admin.php?page=foosales-import7291.537.6416.33

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
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_recent-posts
    • recovery_mode_email_last_sent
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • foosales_cashier_role_version
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=foosales-settings
    • > Error in wp-content/plugins/foosales/helpers/foosales-api-helper.php+4572
    Uncaught Error: Call to undefined function wc_get_order_statuses() in wp-content/plugins/foosales/helpers/foosales-api-helper.php:4572
    Stack trace:
    #0 wp-content/plugins/foosales/classes/class-foosales.php(427): fsfwc_get_all_order_statuses()
    #1 wp-includes/class-wp-hook.php(310): FooSales->fsfwc_display_settings_page()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=foosales-import
    • > Error in wp-content/plugins/foosales/helpers/foosales-api-helper.php+4572
    Uncaught Error: Call to undefined function wc_get_order_statuses() in wp-content/plugins/foosales/helpers/foosales-api-helper.php:4572
    Stack trace:
    #0 wp-content/plugins/foosales/classes/class-foosales.php(1681): fsfwc_get_all_order_statuses()
    #1 wp-includes/class-wp-hook.php(310): FooSales->fsfwc_add_foosales_import_page()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown

SRP 50% 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
Please fix the following
  • 259× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\Exception\\OAuth\\OAuthErrorException' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Exception/OAuth/UnknownOAuthErrorException.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\ApiResource' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/FinancialConnections/Session.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'FooSales\\Stripe\\Exception\\ExceptionInterface' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Exception/ApiErrorException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\Service\\AbstractServiceFactory' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Service/Apps/AppsServiceFactory.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\Service\\AbstractService' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Service/TestHelpers/Issuing/TransactionService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\Service\\AbstractService' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Service/TestHelpers/Treasury/OutboundTransferService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\Service\\AbstractService' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Service/CouponService.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'FooSales\\Stripe\\Exception\\ExceptionInterface' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Exception/InvalidArgumentException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\ApiResource' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/BalanceTransaction.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'FooSales\\Stripe\\ApiResource' not found in wp-content/plugins/foosales/vendor/stripe-php/lib/Customer.php:41

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Screenshots: These screenshots require images: #1 (Add a product to the cart by selecting it from the list or by scanning its barcode.), #2 (Checkout to complete the order.), #3 (Create profiles for your customers so that you can learn more about their shopping habits and view contact info and order history at a glance.), #4 (View your sales history, cancel completed orders and print receipts), #5 (FooSales POS can be accessed from an unlimited number of devices and is available as a web app and native tablets apps (iPad & Android tablet).)
The official readme.txt might help

foosales/foosales.php 92% from 13 tests

The primary PHP file in "FooSales — Point of Sale (POS) for WooCommerce" version 1.37.3 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Description: Keep the plugin description shorter than 140 characters (currently 372 characters long)

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Please make sure to remedy the following
  • For security reasons, never distribute binary or executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/foosales/vendor/stripe-php/data/ca-certificates.crt
46,091 lines of code in 344 files:
LanguageFilesBlank linesComment linesLines of code
PO File2813,32813,30028,224
PHP3084,89613,90017,239
CSS200334
JavaScript4344184
Markdown2390110

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity3.83
▷ Minimum class complexity1.00
▷ Maximum class complexity235.00
Average method complexity1.81
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces36
Interfaces9
Traits9
Classes281
▷ Abstract classes103.56%
▷ Concrete classes27196.44%
▷ Final classes00.00%
Methods998
▷ Static methods18818.84%
▷ Public methods91291.38%
▷ Protected methods414.11%
▷ Private methods454.51%
Functions98
▷ Named functions7778.57%
▷ Anonymous functions2121.43%
Constants1,502
▷ Global constants20.13%
▷ Class constants1,50099.87%
▷ Public constants1,500100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
6 PNG files occupy 1.13MB with 0.68MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png241.93KB82.49KB▼ 65.90%
screenshot-3.png208.30KB87.55KB▼ 57.97%
screenshot-2.png213.97KB87.58KB▼ 59.07%
screenshot-4.png263.77KB91.72KB▼ 65.23%
images/foosales-favicon.png7.16KB3.59KB▼ 49.90%