10% cargo-shipping-location-for-woocommerce

Code Review | Cargo Shipping Location for WooCommerce

WordPress plugin Cargo Shipping Location for WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: cargo-shipping-lo...
  • Plugin version: 3.8
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.1.0-6.1
  • WordPress version: 6.3.1
  • First release: Mar 15, 2023
  • Latest release: Nov 7, 2023
  • Number of updates: 28
  • Update frequency: every 8.6 days
  • Top authors: cargord (100%)

Code review

54 tests

User reviews

1 review

Install metrics

80+ active /1,011 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
It is recommended to fix the following installer errors
  • Install procedure had errors
    • > Warning in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-logs.php+20
    scandir(wp-content/uploads/cargo-shipping-location): failed to open dir: No such file or directory

Server metrics [RAM: ▼1.65MB] [CPU: ▼49.00ms] Passed 4 tests

This is a short check of server-side resources used by Cargo Shipping Location for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.40 ▼1.077.03 ▼30.86
Dashboard /wp-admin2.34 ▼0.9610.15 ▼48.19
Posts /wp-admin/edit.php2.34 ▼1.0211.05 ▼37.41
Add New Post /wp-admin/post-new.php2.34 ▼3.558.96 ▼79.54
Media Library /wp-admin/upload.php2.34 ▼0.899.89 ▼23.72
Orders Reindex /wp-admin/admin.php?page=cargo_orders_reindex2.3411.60
Log Files /wp-admin/admin.php?page=cargo_shipping_log2.349.14
Cargo Shipping Location /wp-admin/admin.php?page=loaction_api_settings2.3410.87
Contact Us /wp-admin/admin.php?page=cargo_shipping_contact2.348.95

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 71 new files
Database: no new tables, 7 new options
New WordPress options
recovery_mode_email_last_sent
db_upgraded
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Cargo Shipping Location for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,524 ▼23814.30 ▼0.050.67 ▼0.9117.98 ▼26.24
Dashboard /wp-admin2,250 ▲735.62 ▼0.0297.64 ▲5.3481.08 ▲38.83
Posts /wp-admin/edit.php920 ▼1,1801.12 ▼0.868.39 ▼29.9222.15 ▼16.77
Add New Post /wp-admin/post-new.php1,587 ▲6123.10 ▼0.11766.72 ▲74.0951.79 ▼5.70
Media Library /wp-admin/upload.php1,461 ▲614.19 ▼0.0593.80 ▼6.8674.06 ▲31.99
Orders Reindex /wp-admin/admin.php?page=cargo_orders_reindex7271.127.9619.43
Log Files /wp-admin/admin.php?page=cargo_shipping_log7271.516.4721.50
Cargo Shipping Location /wp-admin/admin.php?page=loaction_api_settings7271.127.4521.88
Contact Us /wp-admin/admin.php?page=cargo_shipping_contact9852.1934.8625.20

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Warning in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-logs.php+20
    scandir(wp-content/uploads/cargo-shipping-location): failed to open dir: No such file or directory
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_recent-posts
    • db_upgraded
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 16 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=cargo_shipping_contact
    • > Warning in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-logs.php+20
    scandir(wp-content/uploads/cargo-shipping-location): failed to open dir: No such file or directory
  • 16 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=cargo_shipping_contact
    • > Warning in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-logs.php+20
    scandir(): (errno 2): No such file or directory

SRP 0% 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 items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cargo-shipping-location-for-woocommerce/templates/old_plugin_reindex.php
  • 14× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/cargo-shipping-location-for-woocommerce/templates/checkout-popups.php:2
    • > PHP Fatal error
      require(): Failed opening required 'CSLFW_PATH/includes/cslfw-helpers.php' (include_path='.:/usr/share/php') in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-cargo.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shipping_Method' not found in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/woo-baldarp-shipping.php:3
    • > PHP Warning
      Use of undefined constant CSLFW_PATH - assumed 'CSLFW_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-admin.php on line 9
    • > PHP Fatal error
      Uncaught Error: Class 'CSLFW_Helpers' not found in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-front.php:15
    • > PHP Warning
      require(CSLFW_PATH/includes/cslfw-cargo.php): failed to open stream: No such file or directory in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-admin.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/cargo-shipping-location-for-woocommerce/templates/settings.php:2
    • > PHP Warning
      Use of undefined constant CSLFW_PATH - assumed 'CSLFW_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-cargo.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'CSLFW_Helpers' not found in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/cslfw-settings.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shipping_Method' not found in wp-content/plugins/cargo-shipping-location-for-woocommerce/includes/woo-baldarp-express-shipping.php:3

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

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
5 plugin tags: delivery, woo-commerce, woocommerce, cargo, shipment

cargo-shipping-location-for-woocommerce/cargo-shipping-location.php 92% from 13 tests

The primary PHP file in "Cargo Shipping Location for WooCommerce" version 3.8 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("cargo-shipping-location-for-woocommerce.php" instead of "cargo-shipping-location.php")

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
No dangerous file extensions were detected4,007 lines of code in 55 files:
LanguageFilesBlank linesComment linesLines of code
PHP193232842,461
JavaScript96749892
CSS44418516
SVG2300138

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity30.55
▷ Minimum class complexity2.00
▷ Maximum class complexity116.00
Average method complexity4.57
▷ Minimum method complexity1.00
▷ Maximum method complexity53.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods91
▷ Static methods00.00%
▷ Public methods91100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
13 PNG files occupy 1.14MB with 0.55MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/image/order-closed-img.png25.88KB11.15KB▼ 56.91%
assets/image/default_new.png1.85KB1.49KB▼ 19.81%
assets/image/dummy-img-3.png30.50KB13.67KB▼ 55.17%
assets/image/dummy-img-2.png33.10KB14.50KB▼ 56.19%
assets/image/default-marker.png8.58KB4.04KB▼ 52.89%