77% elex-australia-post-shipping

Code Review | ELEX WooCommerce Australia Post Shipping

WordPress plugin ELEX WooCommerce Australia Post Shipping scored 77% from 54 tests.

About plugin

  • Plugin page: elex-australia-po...
  • Plugin version: 3.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-6.3
  • WordPress version: 6.3.1
  • First release: Feb 4, 2022
  • Latest release: Sep 20, 2023
  • Number of updates: 13
  • Update frequency: every 45.7 days
  • Top authors: elextensions (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active / 2,201 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.00MB] [CPU: ▼1.59ms] Passed 4 tests

An overview of server-side resources used by ELEX WooCommerce Australia Post Shipping
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0040.64 ▼1.72
Dashboard /wp-admin3.31 ▲0.0045.00 ▼1.24
Posts /wp-admin/edit.php3.36 ▲0.0046.90 ▼1.37
Add New Post /wp-admin/post-new.php5.89 ▲0.0091.37 ▲5.04
Media Library /wp-admin/upload.php3.23 ▲0.0035.21 ▼2.02

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

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

Browser metrics Passed 4 tests

ELEX WooCommerce Australia Post Shipping: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲4313.20 ▼1.111.75 ▲0.0945.48 ▼2.17
Dashboard /wp-admin2,209 ▲245.84 ▼0.0297.67 ▼2.7241.56 ▲5.47
Posts /wp-admin/edit.php2,089 ▼02.04 ▲0.0640.32 ▲3.4833.68 ▲1.67
Add New Post /wp-admin/post-new.php1,514 ▼517.90 ▼4.99638.92 ▼2.7656.95 ▼2.22
Media Library /wp-admin/upload.php1,388 ▼04.17 ▼0.0796.82 ▼15.4742.77 ▼11.24

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/elex-australia-post-shipping/review_and_troubleshoot_notify/resources/logo.php
  • 10× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/elex-australia-post-shipping/includes/market.php:86
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/elex-australia-post-shipping/australia-post-deprecated-functions.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-australia-post-shipping/review_and_troubleshoot_notify/resources/review.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/elex-australia-post-shipping/australia-post-woocommerce-shipping.php:28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/elex-australia-post-shipping/includes/class-elex-australia-post-functions.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-australia-post-shipping/review_and_troubleshoot_notify/resources/troubleshoot.php:59
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/elex-australia-post-shipping/includes/data-elex-default-values.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/elex-australia-post-shipping/includes/settings/wf_html_services.php:43
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/elex-australia-post-shipping/includes/settings/aus_general_settings.php:25
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/elex-australia-post-shipping/includes/settings/aus_rates_settings.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 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
Attributes that need to be fixed:
  • Donate link: Please fix this invalid URI: ""
You can look at the official readme.txt

elex-australia-post-shipping/australia-post-woocommerce-shipping.php 77% from 13 tests

The main PHP file in "ELEX WooCommerce Australia Post Shipping" ver. 3.0.0 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Requires at least: The required version number must match the one declared in readme.txt ("3.0.1" instead of "2.6")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("elex-australia-post-shipping.php" instead of "australia-post-woocommerce-shipping.php")

Code Analysis 97% from 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
There were no executable files found in this plugin11,861 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
CSS11,709219,102
PHP143842292,709
JavaScript29250

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
The following items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 124)
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity47.71
▷ Minimum class complexity7.00
▷ Maximum class complexity237.00
Average method complexity6.74
▷ Minimum method complexity1.00
▷ Maximum method complexity124.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods57
▷ Static methods00.00%
▷ Public methods4171.93%
▷ Protected methods00.00%
▷ Private methods1628.07%
Functions33
▷ Named functions3296.97%
▷ Anonymous functions13.03%
Constants6
▷ Global constants466.67%
▷ Class constants233.33%
▷ Public constants2100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
9 PNG files occupy 0.84MB with 0.60MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/EasyPost_shipping.png138.94KB38.02KB▼ 72.63%
img/USPS.png86.83KB21.30KB▼ 75.47%
includes/settings/aus.png24.53KB11.06KB▼ 54.90%
img/address_validation_2.png92.01KB25.03KB▼ 72.79%
img/DHL.png60.09KB12.00KB▼ 80.03%