74% woocommerce-square

Code Review | WooCommerce Square

WordPress plugin WooCommerce Square scored74%from 54 tests.

About plugin

  • Plugin page: woocommerce-square
  • Plugin version: 4.3.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.1-6.3.0
  • WordPress version: 6.3.1
  • First release: Jan 29, 2018
  • Latest release: Nov 7, 2023
  • Number of updates: 151
  • Update frequency: every 14.2 days
  • Top authors: automattic (70.2%)royho (11.26%)bor0 (7.95%)ferdev (7.28%)cshultz88 (5.96%)

Code review

54 tests

User reviews

102 reviews

Install metrics

90,000+ active /3,611,536 total downloads

Benchmarks

Plugin footprint 65% from 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: ▲1.10MB] [CPU: ▲12.78ms] Passed 4 tests

A check of server-side resources used by WooCommerce Square
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.57 ▲1.1151.37 ▲15.50
Dashboard /wp-admin4.40 ▲1.0958.64 ▲6.05
Posts /wp-admin/edit.php4.51 ▲1.1560.18 ▲13.32
Add New Post /wp-admin/post-new.php6.98 ▲1.09105.65 ▲16.79
Media Library /wp-admin/upload.php4.32 ▲1.0951.90 ▲16.26
Scheduled Actions /wp-admin/tools.php?page=action-scheduler4.5052.12

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 3,647 new files
Database: 4 new tables, 9 new options
New tables
wp_actionscheduler_groups
wp_actionscheduler_logs
wp_actionscheduler_claims
wp_actionscheduler_actions
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
schema-ActionScheduler_LoggerSchema
action_scheduler_hybrid_store_demarkation
schema-ActionScheduler_StoreSchema
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by WooCommerce Square
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,809 ▲4714.67 ▲0.361.60 ▼0.1037.94 ▲0.12
Dashboard /wp-admin2,214 ▲405.61 ▲0.1193.44 ▲1.9142.10 ▲1.33
Posts /wp-admin/edit.php2,120 ▲201.97 ▲0.0242.64 ▲6.2037.86 ▲2.59
Add New Post /wp-admin/post-new.php1,553 ▲2724.92 ▲2.21637.33 ▼60.6469.84 ▲2.94
Media Library /wp-admin/upload.php1,419 ▲254.22 ▼0.05101.98 ▲2.7744.83 ▼0.88
Scheduled Actions /wp-admin/tools.php?page=action-scheduler1,2681.8323.5928.01

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • The plugin did not uninstall successfully, leaving 4 tables in the database
    • wp_actionscheduler_actions
    • wp_actionscheduler_claims
    • wp_actionscheduler_logs
    • wp_actionscheduler_groups
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • db_upgraded
    • schema-ActionScheduler_StoreSchema
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • action_scheduler_hybrid_store_demarkation
    • theysaidso_admin_options
    • can_compress_scripts
    • schema-ActionScheduler_LoggerSchema

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 198× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Core\\Types\\Sdk\\CoreFileWrapper' not found in wp-content/plugins/woocommerce-square/vendor/square/square/src/Utils/FileWrapper.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Square\\Apis\\BaseApi' not found in wp-content/plugins/woocommerce-square/vendor/square/square/src/Apis/EmployeesApi.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'CoreInterfaces\\Core\\Request\\RequestInterface' not found in wp-content/plugins/woocommerce-square/vendor/apimatic/unirest-php/src/Request/Request.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/woocommerce-square/vendor/apimatic/unirest-php/tests/ResponseTest.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'ActionScheduler_Exception' not found in wp-content/plugins/woocommerce-square/vendor/woocommerce/action-scheduler/classes/ActionScheduler_InvalidActionException.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Order' not found in wp-content/plugins/woocommerce-square/includes/WC_Order_Square.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/woocommerce-square/vendor/apimatic/core/tests/ClientTest.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'JsonMapperTest_SimpleBase' not found in wp-content/plugins/woocommerce-square/vendor/apimatic/jsonmapper/tests/JsonMapperTest/DerivedClass.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Square\\Apis\\BaseApi' not found in wp-content/plugins/woocommerce-square/vendor/square/square/src/Apis/SubscriptionsApi.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CLI_Command' not found in wp-content/plugins/woocommerce-square/vendor/woocommerce/action-scheduler/classes/WP_CLI/Migration_Command.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
4 plugin tags: square, credit card, woocommerce, inventory sync

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

Analyzing the main PHP file in "WooCommerce Square" version 4.3.1
The following require your attention:
  • Description: Please keep the plugin description shorter than 140 characters (currently 143 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Success! There were no dangerous files found in this plugin209,093 lines of code in 3,587 files:
LanguageFilesBlank linesComment linesLines of code
PHP2,38943,451139,677152,688
Markdown1,09513,656052,892
JavaScript423201631,714
JSON800661
XML8340489
YAML12367380
reStructuredText1156144224
SVG220030
CSS9009
Bourne Shell1336

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity9.66
▷ Minimum class complexity1.00
▷ Maximum class complexity274.00
Average method complexity1.82
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces77
Interfaces29
Traits0
Classes2,329
▷ Abstract classes301.29%
▷ Concrete classes2,29998.71%
▷ Final classes00.00%
Methods19,778
▷ Static methods1,2916.53%
▷ Public methods18,21492.09%
▷ Protected methods5402.73%
▷ Private methods1,0245.18%
Functions960
▷ Named functions191.98%
▷ Anonymous functions94198.02%
Constants1,526
▷ Global constants70.46%
▷ Class constants1,51999.54%
▷ Public constants1,51899.93%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
26 compressed PNG files occupy 0.05MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/sample-check.png6.29KB6.96KB0.00%
assets/images/card-echeck.png1.09KB1.15KB0.00%
assets/images/card-switch.png0.64KB0.68KB0.00%
assets/images/card-google.png2.32KB1.87KB▼ 19.27%
assets/images/card-visa-electron.png0.94KB1.00KB0.00%