10% hit-dhl-real-time-rates-and-shipping-label-xml-based

Code Review | DHL Express live shipping rates and labels

WordPress plugin DHL Express live shipping rates and labels scored 10% from 54 tests.

About plugin

  • Plugin page: hit-dhl-real-time...
  • Plugin version: 1.0.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-5.8
  • WordPress version: 5.9.2
  • First release: Jul 14, 2021
  • Latest release: Jul 15, 2021
  • Number of updates: 3
  • Update frequency: every 0.3 days
  • Top authors: hitstacks (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 165 total downloads

Benchmarks

Plugin footprint 75% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Please fix the following installer errors
  • The plugin cannot be installed
    • > Error in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/hit_m_dhlexpress_basic.php+32
    Uncaught Error: Call to undefined function WC() in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/hit_m_dhlexpress_basic.php:32
    Stack trace:
    #0 wp-includes/class-wp-hook.php(309): hit_m_woo_dhl_express_plugin_activation()
    #1 wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(474): WP_Hook->do_action()
    #3 wp-admin/includes/plugin.php(716): do_action()

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

A check of server-side resources used by DHL Express live shipping rates and labels
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.0756.70 ▲5.98
Dashboard /wp-admin3.41 ▲0.0137.06 ▲0.03
Posts /wp-admin/edit.php3.65 ▲0.0135.76 ▼0.78
Add New Post /wp-admin/post-new.php6.89 ▼0.0895.27 ▼1,207.12
Media Library /wp-admin/upload.php3.30 ▼0.0025.60 ▼2.36

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 1,341 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for DHL Express live shipping rates and labels
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,785 ▲6315.92 ▼0.036.06 ▲0.262.11 ▼0.18
Dashboard /wp-admin2,892 ▲316.09 ▼0.07122.70 ▼7.59157.34 ▼5.59
Posts /wp-admin/edit.php2,694 ▼03.22 ▼0.0263.05 ▼1.39140.68 ▲1.48
Add New Post /wp-admin/post-new.php1,635 ▼12717.29 ▼1.87463.69 ▲77.28152.52 ▼3.77
Media Library /wp-admin/upload.php1,698 ▼05.52 ▲0.01143.48 ▲0.30190.92 ▲4.70

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
  • 693× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/google/common-protos/src/Api/Servicecontrol/V1/ReportResponse.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/google/gax/tests/Tests/Unit/ServerStreamTest.php:42
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Exception\\GuzzleException' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Google\\Cloud\\Translate\\V2\\Connection\\ConnectionInterface' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/google/cloud-translate/src/V2/Connection/Rest.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/google/common-protos/src/Api/Servicecontrol/V1/Distribution/ExplicitBuckets.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\SocketHandler' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/google/common-protos/src/Rpc/PreconditionFailure.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/google/common-protos/src/Rpc/BadRequest.php:17

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

readme.txt 88% 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
These attributes need your attention: Please take inspiration from this readme.txt

hit-dhl-real-time-rates-and-shipping-label-xml-based/hit_m_dhlexpress_basic.php 77% from 13 tests

The principal PHP file in "DHL Express live shipping rates and labels" v. 1.0.1 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes
  • Requires at least: The required version number must match the one declared in readme.txt ("4.0.1" instead of "2.6")
  • Main file name: Name the main plugin file the same as the plugin slug ("hit-dhl-real-time-rates-and-shipping-label-xml-based.php" instead of "hit_m_dhlexpress_basic.php")

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
It is important to fix the following items
  • Do not distribute dangerous files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/hit-dhl-real-time-rates-and-shipping-label-xml-based/controllors/classes/gtrans/vendor/bin/google-cloud-batch.bat
81,505 lines of code in 1,293 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,18816,07471,25872,212
Markdown421,66805,164
JSON36403,250
XML715279
XSLT22320209
Bourne Shell94681172
YAML410098
Protocol Buffers2143862
Python1174346
make1409
DOS Batch1004

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
The following items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 186)
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity5.45
▷ Minimum class complexity1.00
▷ Maximum class complexity432.00
Average method complexity1.79
▷ Minimum method complexity1.00
▷ Maximum method complexity186.00
Code structure
Namespaces165
Interfaces52
Traits58
Classes1,051
▷ Abstract classes181.71%
▷ Concrete classes1,03398.29%
▷ Final classes151.45%
Methods6,445
▷ Static methods5628.72%
▷ Public methods5,71188.61%
▷ Protected methods2353.65%
▷ Private methods4997.74%
Functions292
▷ Named functions7826.71%
▷ Anonymous functions21473.29%
Constants584
▷ Global constants30.51%
▷ Class constants58199.49%
▷ Public constants56196.56%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 PNG files occupy 0.15MB with 0.09MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
controllors/views/hdhl.png6.93KB3.56KB▼ 48.66%
controllors/views/dhl.png27.25KB10.29KB▼ 62.23%
dhl.png119.73KB45.66KB▼ 61.87%