78% flexible-shipping-usps

Code Review | USPS Shipping for WooCommerce - Live Rates

WordPress plugin USPS Shipping for WooCommerce - Live Rates scored78%from 54 tests.

About plugin

  • Plugin page: flexible-shipping...
  • Plugin version: 1.8.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8-6.4
  • WordPress version: 6.3.1
  • First release: Oct 22, 2021
  • Latest release: Nov 30, 2023
  • Number of updates: 85
  • Update frequency: every 9.1 days
  • Top authors: octolize (71.76%)wpdesk (29.41%)

Code review

54 tests

User reviews

12 reviews

Install metrics

1,000+ active /28,727 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.54MB] [CPU: ▼2.92ms] Passed 4 tests

Analyzing server-side resources used by USPS Shipping for WooCommerce - Live Rates
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.02 ▲0.5643.67 ▲2.66
Dashboard /wp-admin3.85 ▲0.5150.15 ▼11.61
Posts /wp-admin/edit.php3.91 ▲0.5551.39 ▲2.03
Add New Post /wp-admin/post-new.php6.44 ▲0.5593.45 ▼4.77
Media Library /wp-admin/upload.php3.78 ▲0.5538.64 ▲6.06

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 693 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
plugin_activation_flexible-shipping-usps/flexible-shipping-usps.php
wpdesk_requirements_plugins_data
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by USPS Shipping for WooCommerce - Live Rates
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲4814.72 ▲0.381.81 ▲0.0745.40 ▲0.80
Dashboard /wp-admin2,197 ▲205.49 ▼0.1589.89 ▼10.1541.55 ▼2.50
Posts /wp-admin/edit.php2,105 ▲52.00 ▼0.0139.30 ▼0.8337.93 ▲1.20
Add New Post /wp-admin/post-new.php1,531 ▲523.56 ▲0.41603.53 ▼69.9655.84 ▲9.67
Media Library /wp-admin/upload.php1,402 ▲84.18 ▼0.0296.35 ▼1.6540.61 ▲0.24

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 8 options
    • plugin_activation_flexible-shipping-usps/flexible-shipping-usps.php
    • widget_recent-comments
    • widget_theysaidso_widget
    • wpdesk_requirements_plugins_data
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
  • 5× PHP files output text when accessed directly:
    • > /wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-woocommerce-shipping/src/WooCommerceShipping/ShippingMethod/Traits/view/shipping-method-java-script-custom-services.php
    • > /wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-woocommerce-shipping/src/WooCommerceShipping/ShippingMethod/Traits/view/shipping-method-java-script-free-shipping.php
    • > /wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-woocommerce-shipping/src/WooCommerceShipping/ShippingMethod/Traits/view/shipping-method-java-script-custom-origin.php
    • > /wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-usps-shipping-method/src/WooCommerceShipping/Usps/view/shipping-method-script.php
    • > /wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-woocommerce-shipping/src/WooCommerceShipping/ShippingMethod/Traits/view/shipping-method-java-script-fallback.php
  • 326× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'FlexibleShippingUspsVendor\\WPDesk\\Persistence\\PersistentContainer' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-persistence/src/Adapter/WordPress/WordpressTransientContainer.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleShippingUspsVendor\\Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'FlexibleShippingUspsVendor\\WPDesk\\Persistence\\PersistentContainer' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-persistence/src/Adapter/ArrayContainer.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'FlexibleShippingUspsVendor\\WPDesk\\PluginBuilder\\Plugin\\Hookable' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/octolize/wp-octolize-tracker/src/OptInNotice/OptInNotice.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'FlexibleShippingUspsVendor\\Behat\\Behat\\Context\\Context' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/dvdoug/boxpacker/features/bootstrap/PackerContext.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleShippingUspsVendor\\WpDesk\\WooCommerce\\ShippingMethod\\AbstractBox' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-settings-field-boxes/src/SettingsBox.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-settings-field-boxes/src/views/settings-field.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'FlexibleShippingUspsVendor\\WPDesk\\WooCommerceShipping\\ShippingMethod\\RateMethod\\RateMethod' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/wpdesk/wp-woocommerce-shipping/src/WooCommerceShipping/ShippingMethod/RateMethod/Fallback/FallbackRateMethod.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'WPDesk_Tracker_Sender' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/octolize/wp-octolize-tracker/src/SenderToOctolize.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'FlexibleShippingUspsVendor\\Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/flexible-shipping-usps/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php:26

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

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: usps rates, usps live rates, usps woocommerce, usps, usps shipping

flexible-shipping-usps/flexible-shipping-usps.php 92% from 13 tests

The main PHP script in "USPS Shipping for WooCommerce - Live Rates" version 1.8.0 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("5.7" instead of "5.8")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected27,231 lines of code in 666 files:
LanguageFilesBlank linesComment linesLines of code
PHP5901,41119,18825,191
JSON31001,479
CSS8372201
SVG2200179
JavaScript131625156
Markdown25025

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity5.43
▷ Minimum class complexity1.00
▷ Maximum class complexity79.00
Average method complexity2.11
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces107
Interfaces97
Traits23
Classes415
▷ Abstract classes204.82%
▷ Concrete classes39595.18%
▷ Final classes266.58%
Methods2,343
▷ Static methods1315.59%
▷ Public methods1,79376.53%
▷ Protected methods23610.07%
▷ Private methods31413.40%
Functions62
▷ Named functions1422.58%
▷ Anonymous functions4877.42%
Constants332
▷ Global constants30.90%
▷ Class constants32999.10%
▷ Public constants29389.06%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
9 PNG files occupy 0.12MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/beacon-transparent.png2.13KB1.17KB▼ 45.35%
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/flexibleshipping.com.png5.63KB3.68KB▼ 34.58%
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/wpdesk.net.png2.36KB2.43KB0.00%
assets/images/beacon-better-transparent.png9.82KB0.71KB▼ 92.75%
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/octolize.com.png88.91KB39.07KB▼ 56.06%