83% royal-mail-woocommerce-shipping-calculator

Code Review | WooCommerce Royal Mail Shipping Calculator

WordPress plugin WooCommerce Royal Mail Shipping Calculator scored83%from 54 tests.

About plugin

  • Plugin page: royal-mail-woocom...
  • Plugin version: 1.7.12
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.3
  • WordPress version: 6.3.1
  • First release: May 31, 2016
  • Latest release: Nov 1, 2023
  • Number of updates: 89
  • Update frequency: every 30.5 days
  • Top authors: waseem_senjer (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

1,000+ active /34,727 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.08MB] [CPU: ▼3.08ms] Passed 4 tests

Analyzing server-side resources used by WooCommerce Royal Mail Shipping Calculator
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0841.26 ▼2.26
Dashboard /wp-admin3.39 ▲0.0847.84 ▼2.14
Posts /wp-admin/edit.php3.50 ▲0.1452.75 ▲7.61
Add New Post /wp-admin/post-new.php5.97 ▲0.0894.47 ▼5.54
Media Library /wp-admin/upload.php3.31 ▲0.0834.23 ▼2.39

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

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

Browser metrics Passed 4 tests

Checking browser requirements for WooCommerce Royal Mail Shipping Calculator
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.25 ▼0.101.99 ▲0.0344.12 ▼0.33
Dashboard /wp-admin2,198 ▲205.65 ▼0.0389.29 ▼18.4640.71 ▼3.62
Posts /wp-admin/edit.php2,100 ▼02.03 ▲0.0138.75 ▼3.8135.69 ▲2.18
Add New Post /wp-admin/post-new.php1,537 ▲1118.18 ▼4.87610.69 ▼81.1777.68 ▲20.47
Media Library /wp-admin/upload.php1,403 ▲34.24 ▲0.0594.58 ▼9.6240.30 ▼5.78

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 75% 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)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
The following issues need your attention
  • 47× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WPRuby\\RoyalMailLite\\PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\Imposter\\ImposterInterface' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/vendor/typisttech/imposter/src/Imposter.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WPRuby\\RoyalMailLite\\Psr\\Log\\AbstractLogger' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/vendor/psr/log/Psr/Log/NullLogger.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shipping_Method' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/class-wc-royal-mail-shipping-method.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/vendor/dvdoug/boxpacker/tests/OrientatedItemTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Royal_Mail_Shipping_Method' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/class-wc-royal-mail-shipping-method-legacy.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/vendor/dvdoug/boxpacker/tests/EfficiencyTest.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'WPRuby\\RoyalMailLite\\DVDoug\\BoxPacker\\Item' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/vendor/dvdoug/boxpacker/tests/Test/TestItem.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/includes/admin-options.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'WPRuby\\RoyalMailLite\\DVDoug\\BoxPacker\\Test\\TestItem' not found in wp-content/plugins/royal-mail-woocommerce-shipping-calculator/vendor/dvdoug/boxpacker/tests/Test/ConstrainedPlacementNoStackingTestItem.php:14

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 86% 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
10 plugin tags: woocommerce, evri, woocommerce extension, shipping, royal mail...

royal-mail-woocommerce-shipping-calculator/wc-royal-mail.php 69% from 13 tests

"WooCommerce Royal Mail Shipping Calculator" version 1.7.12's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Domain Path: The domain path folder does not exist ("/languages")
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("royal-mail-woocommerce-shipping-calculator.php" instead of "wc-royal-mail.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Requires at least: The required version number did not match the one declared in readme.txt ("5.0" instead of "3.0")

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
There were no executable files found in this plugin6,890 lines of code in 107 files:
LanguageFilesBlank linesComment linesLines of code
PHP911,3873,2196,036
JSON100312
YAML4443192
Cucumber2200148
reStructuredText791187136
Python1399240
XML15126

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.19
Average class complexity6.37
▷ Minimum class complexity1.00
▷ Maximum class complexity87.00
Average method complexity1.97
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces9
Interfaces12
Traits2
Classes70
▷ Abstract classes22.86%
▷ Concrete classes6897.14%
▷ Final classes00.00%
Methods496
▷ Static methods418.27%
▷ Public methods43687.90%
▷ Protected methods112.22%
▷ Private methods499.88%
Functions28
▷ Named functions13.57%
▷ Anonymous functions2796.43%
Constants20
▷ Global constants00.00%
▷ Class constants20100.00%
▷ Public constants1995.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
includes/assets/images/wpruby_logo.png10.60KB8.55KB▼ 19.39%