10% automated-postnord-shipping

Code Review | Automated PostNord label and pickup

WordPress plugin Automated PostNord label and pickup scored10%from 54 tests.

About plugin

  • Plugin page: automated-postnor...
  • Plugin version: 1.1.6
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-6.1
  • WordPress version: 6.3.1
  • First release: Jun 5, 2021
  • Latest release: Jun 27, 2023
  • Number of updates: 19
  • Update frequency: every 39.6 days
  • Top authors: hitstacks (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /2,226 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
It is recommended to fix the following installer errors
  • This plugin did not install gracefully
    • > Error in wp-content/plugins/automated-postnord-shipping/hitshipo_pn_basic.php+36
    Uncaught Error: Call to undefined function WC() in wp-content/plugins/automated-postnord-shipping/hitshipo_pn_basic.php:36
    Stack trace:
    #0 wp-includes/class-wp-hook.php(312): hitshipo_woo_pn_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.34MB] [CPU: ▼6.39ms] Passed 4 tests

Analyzing server-side resources used by Automated PostNord label and pickup
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.82 ▲0.3538.72 ▼3.06
Dashboard /wp-admin3.66 ▲0.3146.33 ▼22.54
Posts /wp-admin/edit.php3.77 ▲0.4151.15 ▲7.41
Add New Post /wp-admin/post-new.php6.24 ▲0.3588.59 ▼4.03
Media Library /wp-admin/upload.php3.58 ▲0.3538.60 ▲4.09

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 1,339 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

This is an overview of browser requirements for Automated PostNord label and pickup
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.55 ▲0.201.61 ▼0.1137.64 ▼9.90
Dashboard /wp-admin2,195 ▲215.61 ▲0.0490.37 ▼11.1836.63 ▼5.72
Posts /wp-admin/edit.php2,100 ▼02.02 ▲0.0639.35 ▲2.0437.02 ▲3.05
Add New Post /wp-admin/post-new.php1,526 ▼523.59 ▲0.53687.42 ▲42.1255.45 ▲1.16
Media Library /wp-admin/upload.php1,403 ▼04.18 ▲0.0194.21 ▼3.6641.39 ▼2.53

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • 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)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 693× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Exception\\GuzzleException' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\SocketHandler' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/common-protos/src/Api/Expr/V1beta1/MapValue/Entry.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/common-protos/src/Api/Expr/V1alpha1/Expr.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/common-protos/src/Rpc/RequestInfo.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\SocketHandler' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php:26
    • > PHP Fatal error
      Uncaught Error: Interface 'Grpc\\CallInvoker' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/grpc/grpc/src/lib/DefaultCallInvoker.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/common-protos/src/Rpc/Status.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/common-protos/src/Api/Servicecontrol/V1/Operation.php:16

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

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention:
  • Screenshots: Screenshot #6 (Order page where you can easily get labels.) image missing
The official readme.txt might help

automated-postnord-shipping/hitshipo_pn_basic.php 77% from 13 tests

The main PHP file in "Automated PostNord label and pickup" ver. 1.1.6 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("automated-postnord-shipping.php" instead of "hitshipo_pn_basic.php")
  • Requires at least: Required version must match the one declared in readme.txt ("4.0.1" instead of "2.6")
  • Text Domain: The text domain name should consist of only dashes and lowercase characters

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Almost there! Just fix the following issues
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/bin/google-cloud-batch.bat
82,516 lines of code in 1,291 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,18816,22971,38073,410
Markdown421,66805,164
JSON36403,250
XSLT22320209
Bourne Shell94681172
YAML410098
XML51592
Protocol Buffers2143862
Python1174346
make1409
DOS Batch1004

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
It is recommended to fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 167)
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity5.73
▷ Minimum class complexity1.00
▷ Maximum class complexity502.00
Average method complexity1.84
▷ Minimum method complexity1.00
▷ Maximum method complexity167.00
Code structure
Namespaces165
Interfaces52
Traits58
Classes1,051
▷ Abstract classes181.71%
▷ Concrete classes1,03398.29%
▷ Final classes151.45%
Methods6,441
▷ Static methods5628.73%
▷ Public methods5,71088.65%
▷ Protected methods2353.65%
▷ Private methods4967.70%
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.22MB with 0.13MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
controllors/views/hpn.png7.83KB3.84KB▼ 51.01%
controllors/views/pn.png101.22KB38.30KB▼ 62.16%
pn.png119.73KB45.66KB▼ 61.87%