94% woocommerce-square

Code Review | WooCommerce Square

WordPress plugin WooCommerce Square scored 94% from 54 tests.

About plugin

  • Plugin page: woocommerce-square
  • Plugin version: 2.9.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.9
  • WordPress version: 5.9.2
  • First release: Jan 29, 2018
  • Latest release: Mar 17, 2022
  • Number of updates: 121
  • Update frequency: every 12.8 days
  • Top authors: automattic (62.81%)royho (14.05%)bor0 (9.92%)ferdev (9.09%)cshultz88 (7.44%)

Code review

54 tests

User reviews

83 reviews

Install metrics

100,000+ active / 2,277,247 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.44MB] [CPU: ▼294.61ms] Passed 4 tests

An overview of server-side resources used by WooCommerce Square
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.98 ▲0.4757.86 ▲3.25
Dashboard /wp-admin3.88 ▲0.4840.93 ▲6.18
Posts /wp-admin/edit.php4.10 ▲0.4647.34 ▲5.49
Add New Post /wp-admin/post-new.php7.34 ▲0.3795.00 ▼1,190.06
Media Library /wp-admin/upload.php3.76 ▲0.4731.24 ▲2.88
Scheduled Actions /wp-admin/tools.php?page=action-scheduler3.9230.40

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 1,439 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by WooCommerce Square
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,832 ▲9016.69 ▲0.506.23 ▲0.132.79 ▲0.54
Dashboard /wp-admin2,929 ▲426.49 ▲0.01130.44 ▼24.29158.49 ▼15.68
Posts /wp-admin/edit.php2,716 ▲223.44 ▼0.0062.24 ▼0.73141.54 ▼2.22
Add New Post /wp-admin/post-new.php1,773 ▲2122.98 ▲1.14402.38 ▼53.52158.09 ▲7.78
Media Library /wp-admin/upload.php1,723 ▲225.72 ▼0.04137.73 ▼1.92180.65 ▼6.00
Scheduled Actions /wp-admin/tools.php?page=action-scheduler1,2292.6255.92101.57

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 82× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/woocommerce-square/vendor/prospress/action-scheduler/classes/ActionScheduler_Abstract_ListTable.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'Codeception\\Actor' not found in wp-content/plugins/woocommerce-square/vendor/skyverge/wc-plugin-framework/tests/_support/UnitTester.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'CronExpression_AbstractField' not found in wp-content/plugins/woocommerce-square/vendor/prospress/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Codeception\\Actor' not found in wp-content/plugins/woocommerce-square/vendor/skyverge/wc-plugin-framework/tests/_support/FunctionalTester.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_UnitTestCase' not found in wp-content/plugins/woocommerce-square/vendor/prospress/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_UnitTestCase' not found in wp-content/plugins/woocommerce-square/vendor/prospress/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php:7
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/woocommerce-square/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor-token.php on line 28
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_Store' not found in wp-content/plugins/woocommerce-square/vendor/prospress/action-scheduler/classes/ActionScheduler_wpPostStore.php:6
    • > PHP Fatal error
      Uncaught Error: Interface 'ActionScheduler_Schedule' not found in wp-content/plugins/woocommerce-square/vendor/prospress/action-scheduler/classes/ActionScheduler_SimpleSchedule.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_UnitTestCase' not found in wp-content/plugins/woocommerce-square/vendor/prospress/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 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
4 plugin tags: credit card, square, woocommerce, inventory sync

woocommerce-square/woocommerce-square.php 85% from 13 tests

The principal PHP file in "WooCommerce Square" v. 2.9.1 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 143 characters long)
  • Requires at least: The required version number must match the one declared in readme.txt ("4.6" instead of "3.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin104,912 lines of code in 1,369 files:
LanguageFilesBlank linesComment linesLines of code
PHP75923,86879,53987,515
Markdown5155,934012,995
JavaScript21150831,376
PO File1392692998
CoffeeScript7475320655
Sass711926558
JSON800246
YAML123941225
CSS10185112
XML410101
SVG220061
HTML28050
Bourne Shell110820

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity12.06
▷ Minimum class complexity1.00
▷ Maximum class complexity473.00
Average method complexity1.92
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces31
Interfaces16
Traits0
Classes718
▷ Abstract classes273.76%
▷ Concrete classes69196.24%
▷ Final classes00.00%
Methods8,816
▷ Static methods2242.54%
▷ Public methods8,16292.58%
▷ Protected methods5916.70%
▷ Private methods630.71%
Functions45
▷ Named functions2146.67%
▷ Anonymous functions2453.33%
Constants133
▷ Global constants2317.29%
▷ Class constants11082.71%
▷ Public constants110100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
28 PNG files occupy 0.09MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-maestro.png1.62KB1.69KB0.00%
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-cartebleue.png0.35KB0.38KB0.00%
vendor/prospress/action-scheduler/docs/android-chrome-256x256.png24.02KB12.98KB▼ 45.95%
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-amex.png1.14KB1.21KB0.00%
vendor/prospress/action-scheduler/docs/android-chrome-192x192.png16.63KB8.88KB▼ 46.62%