77% elex-usps-shipping-method

Code Review | ELEX WooCommerce USPS Shipping Method

WordPress plugin ELEX WooCommerce USPS Shipping Method scored77%from 54 tests.

About plugin

  • Plugin page: elex-usps-shippin...
  • Plugin version: 2.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-6.3
  • WordPress version: 6.3.1
  • First release: Jul 2, 2021
  • Latest release: Nov 3, 2023
  • Number of updates: 25
  • Update frequency: every 34.2 days
  • Top authors: elextensions (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

900+ active /11,246 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼5.97ms] Passed 4 tests

Server-side resources used by ELEX WooCommerce USPS Shipping Method
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0235.36 ▼8.94
Dashboard /wp-admin3.32 ▲0.0244.98 ▼4.99
Posts /wp-admin/edit.php3.37 ▲0.0244.13 ▲0.03
Add New Post /wp-admin/post-new.php5.90 ▲0.0280.34 ▼9.96
Media Library /wp-admin/upload.php3.24 ▲0.0136.55 ▲3.69

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

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

Browser metrics Passed 4 tests

Checking browser requirements for ELEX WooCommerce USPS Shipping Method
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲5314.71 ▲0.351.80 ▼0.2244.17 ▲0.63
Dashboard /wp-admin2,192 ▲185.55 ▼0.0384.98 ▼16.6637.52 ▼5.57
Posts /wp-admin/edit.php2,097 ▼31.95 ▼0.0636.88 ▲2.0033.70 ▼2.89
Add New Post /wp-admin/post-new.php1,526 ▼223.26 ▲0.16694.05 ▼26.6257.06 ▼1.35
Media Library /wp-admin/upload.php1,394 ▼64.17 ▼0.09104.40 ▲9.6347.03 ▲1.55

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/elex-usps-shipping-method/review_and_troubleshoot_notify/resources/logo.php
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shipping_Method' not found in wp-content/plugins/elex-usps-shipping-method/includes/class-elex-shipping-usps.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/elex-usps-shipping-method/usps-woocommerce-shipping.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-usps-shipping-method/review_and_troubleshoot_notify/resources/troubleshoot.php:59
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/elex-usps-shipping-method/includes/html-wf-market-content.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-usps-shipping-method/review_and_troubleshoot_notify/resources/review.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/elex-usps-shipping-method/includes/html-wf-services.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Donate link: Invalid URI found ("")
The official readme.txt might help

elex-usps-shipping-method/usps-woocommerce-shipping.php 85% from 13 tests

The main file in "ELEX WooCommerce USPS Shipping Method" v. 2.0.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Requires at least: Required version does not match the one declared in readme.txt ("3.0.1" instead of "2.6")
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("elex-usps-shipping-method.php" instead of "usps-woocommerce-shipping.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected11,403 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
CSS21,708279,108
PHP112822602,284
JavaScript15011

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 135)
Cyclomatic complexity
Average complexity per logical line of code0.54
Average class complexity47.33
▷ Minimum class complexity2.00
▷ Maximum class complexity220.00
Average method complexity6.79
▷ Minimum method complexity1.00
▷ Maximum method complexity135.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods48
▷ Static methods00.00%
▷ Public methods3879.17%
▷ Protected methods00.00%
▷ Private methods1020.83%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
8 PNG files occupy 0.86MB with 0.63MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
resources/images/stamps.png146.37KB39.88KB▼ 72.75%
resources/images/address_validation.png93.76KB25.80KB▼ 72.48%
resources/images/australia_post.png82.67KB20.31KB▼ 75.44%
resources/images/wsdesk.png163.82KB44.61KB▼ 72.77%
resources/images/easypost.png138.04KB37.87KB▼ 72.57%