73% shipping-method-for-ups-and-wc

Code Review | Shipping Method for UPS and WooCommerce

WordPress plugin Shipping Method for UPS and WooCommerce scored73%from 54 tests.

About plugin

  • Plugin page: shipping-method-f...
  • Plugin version: 1.0.3
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.3
  • WordPress version: 6.3.1
  • First release: Mar 17, 2021
  • Latest release: Aug 12, 2023
  • Number of updates: 11
  • Update frequency: every 80.4 days
  • Top authors: waseem_senjer (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /492 total downloads

Benchmarks

Plugin footprint 83% 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: ▲0.26MB] [CPU: ▼0.03ms] Passed 4 tests

Analyzing server-side resources used by Shipping Method for UPS and WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2542.57 ▲0.82
Dashboard /wp-admin3.61 ▲0.3049.66 ▼0.30
Posts /wp-admin/edit.php3.66 ▲0.3049.90 ▲1.16
Add New Post /wp-admin/post-new.php6.12 ▲0.2485.73 ▼1.79
Media Library /wp-admin/upload.php3.47 ▲0.2438.29 ▲2.80

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 467 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

Shipping Method for UPS and WooCommerce: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.27 ▼0.111.81 ▲0.2441.05 ▼0.07
Dashboard /wp-admin2,195 ▲315.62 ▼0.0489.58 ▼7.2741.34 ▲6.48
Posts /wp-admin/edit.php2,100 ▼02.01 ▼0.0339.57 ▼0.8636.03 ▼1.26
Add New Post /wp-admin/post-new.php1,528 ▲223.25 ▼0.36650.10 ▼59.5651.89 ▼3.88
Media Library /wp-admin/upload.php1,403 ▲64.26 ▲0.1193.14 ▼8.8443.61 ▼3.91

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded

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 no errors were found, this is by no means 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
Almost there! Just fix the following items
  • 182× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WPRuby_UPS_Libs\\Ups\\Entity\\ShipTo' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/gabrielbull/ups-api/src/Entity/AlternateDeliveryAddress.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'WPRuby_UPS_Libs\\GuzzleHttp\\Exception\\GuzzleException' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WPRuby_UPS_Libs\\DVDoug\\BoxPacker\\Packer' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/dvdoug/boxpacker/src/InfalliblePacker.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'WPRuby_UPS_Libs\\GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'WPRuby_UPS_Libs\\DVDoug\\BoxPacker\\Item' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/dvdoug/boxpacker/src/ConstrainedPlacementItem.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'WPRuby_UPS_Libs\\GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/guzzlehttp/promises/src/EachPromise.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'WPRuby_UPS_Libs\\Psr\\Http\\Message\\UploadedFileInterface' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/guzzlehttp/psr7/src/UploadedFile.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WPRuby_UPS_Libs\\GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'WPRuby_UPS_Libs\\Ups\odeInterface' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/gabrielbull/ups-api/src/Entity/UnitOfMeasurement.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'WPRuby_UPS_Libs\\Ups\odeInterface' not found in wp-content/plugins/shipping-method-for-ups-and-wc/vendor/gabrielbull/ups-api/src/Entity/Tradeability/Weight.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
7 plugin tags: ups, ups shipping, ups api, woocommerce extension, woocommerce...

shipping-method-for-ups-and-wc/ups-shipping-method.php 77% from 13 tests

"Shipping Method for UPS and WooCommerce" version 1.0.3's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Requires at least: Required version does not match the one declared in readme.txt ("4.0" instead of "3.0")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: The principal plugin file should be the same as the plugin slug ("shipping-method-for-ups-and-wc.php" instead of "ups-shipping-method.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
These items require your attention
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .ps1 - Windows PowerShell Cmdlet in Windows
      • wp-content/plugins/shipping-method-for-ups-and-wc/vendor/dvdoug/boxpacker/docs/build.ps1
32,651 lines of code in 422 files:
LanguageFilesBlank linesComment linesLines of code
PHP3596,16614,39026,023
Markdown171,41204,303
JSON12001,312
YAML7603300
XSD600277
reStructuredText8132260178
Cucumber3220165
Python1399240
XML55130
make28619
Dockerfile1102
PowerShell1002

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity8.62
▷ Minimum class complexity1.00
▷ Maximum class complexity108.00
Average method complexity2.12
▷ Minimum method complexity1.00
▷ Maximum method complexity72.00
Code structure
Namespaces28
Interfaces36
Traits7
Classes298
▷ Abstract classes31.01%
▷ Concrete classes29598.99%
▷ Final classes206.78%
Methods2,290
▷ Static methods1707.42%
▷ Public methods2,08190.87%
▷ Protected methods210.92%
▷ Private methods1888.21%
Functions170
▷ Named functions5532.35%
▷ Anonymous functions11567.65%
Constants422
▷ Global constants10.24%
▷ Class constants42199.76%
▷ Public constants42099.76%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
3 PNG files occupy 0.21MB with 0.15MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-3.png65.50KB18.12KB▼ 72.34%
assets/screenshot-2.png90.53KB27.28KB▼ 69.87%
assets/screenshot-1.png60.96KB18.31KB▼ 69.97%