10% a2z-canada-post-automated-shipping

Code Review | Automated Canada Post - HPOS Supported

WordPress plugin Automated Canada Post - HPOS Supported scored10%from 54 tests.

About plugin

  • Plugin page: a2z-canada-post-a...
  • Plugin version: 2.4.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-6.3
  • WordPress version: 6.3.1
  • First release: Feb 20, 2021
  • Latest release: Sep 1, 2023
  • Number of updates: 43
  • Update frequency: every 21.6 days
  • Top authors: hitstacks (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

40+ active /3,455 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
You still need to fix the following installer errors
  • This plugin did not install gracefully
    • > Error in wp-content/plugins/a2z-canada-post-automated-shipping/hit_canadapost_auto_basic.php+42
    Uncaught Error: Call to undefined function WC() in wp-content/plugins/a2z-canada-post-automated-shipping/hit_canadapost_auto_basic.php:42
    Stack trace:
    #0 wp-includes/class-wp-hook.php(312): hit_woo_cp_plugin_activation()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/includes/plugin.php(720): do_action()

Server metrics [RAM: ▲0.12MB] [CPU: ▼6.03ms] Passed 4 tests

A check of server-side resources used by Automated Canada Post - HPOS Supported
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1236.03 ▼10.13
Dashboard /wp-admin3.43 ▲0.1246.80 ▼4.50
Posts /wp-admin/edit.php3.48 ▲0.1247.48 ▼0.34
Add New Post /wp-admin/post-new.php6.01 ▲0.1282.30 ▼9.14
Media Library /wp-admin/upload.php3.35 ▲0.1235.44 ▼0.32

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 25 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Automated Canada Post - HPOS Supported
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.15 ▼0.471.57 ▼0.3439.16 ▼6.98
Dashboard /wp-admin2,192 ▲155.54 ▼0.0488.05 ▼6.5938.63 ▼5.39
Posts /wp-admin/edit.php2,100 ▼01.97 ▲0.0238.82 ▲2.1738.30 ▲2.72
Add New Post /wp-admin/post-new.php1,526 ▼023.14 ▼0.02659.15 ▲5.0362.67 ▲6.82
Media Library /wp-admin/upload.php1,394 ▼04.35 ▲0.1794.60 ▼2.4140.71 ▼2.07

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded

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 no errors were found, this is by no means 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
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WeightPackStrategy' not found in wp-content/plugins/a2z-canada-post-automated-shipping/controllors/classes/weight_pack/class-hit-weight-strategy-descend.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'WeightPackStrategy' not found in wp-content/plugins/a2z-canada-post-automated-shipping/controllors/classes/weight_pack/class-hit-weight-strategy-simple.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'WeightPackStrategy' not found in wp-content/plugins/a2z-canada-post-automated-shipping/controllors/classes/weight_pack/class-hit-weight-strategy-ascend.php:28

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 90% 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
5 plugin tags: canada post woocommerce, canada post plugin, canada post, canada post shipping, canada post shipping method

a2z-canada-post-automated-shipping/hit_canadapost_auto_basic.php 77% from 13 tests

The principal PHP file in "Automated Canada Post - HPOS Supported" v. 2.4.0 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.0.1" instead of "2.6")
  • Text Domain: Please use dashes and lowercase characters for text domains
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("a2z-canada-post-automated-shipping.php" instead of "hit_canadapost_auto_basic.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin3,604 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP114336743,490
XML510114

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity28.67
▷ Minimum class complexity1.00
▷ Maximum class complexity146.00
Average method complexity4.42
▷ Minimum method complexity1.00
▷ Maximum method complexity48.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes12
▷ Abstract classes18.33%
▷ Concrete classes1191.67%
▷ Final classes00.00%
Methods98
▷ Static methods00.00%
▷ Public methods8990.82%
▷ Protected methods00.00%
▷ Private methods99.18%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
controllors/views/hcp.png7.95KB3.74KB▼ 52.91%
controllors/views/cp_logo.png25.41KB25.40KB0.05%