10% automated-postnord-shipping

Code Review | Automated PostNord label and pickup

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

About plugin

  • Plugin page: automated-postnor...
  • Plugin version: 1.0.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-5.8
  • WordPress version: 5.8.1
  • First release: Jun 5, 2021
  • Latest release: Jul 15, 2021
  • Number of updates: 4
  • Update frequency: every 10.3 days
  • Top authors: hitstacks (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 187 total downloads

Benchmarks

Plugin footprint 75% 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+32
    Uncaught Error: Call to undefined function WC() in wp-content/plugins/automated-postnord-shipping/hitshipo_pn_basic.php:32
    Stack trace:
    #0 wp-includes/class-wp-hook.php(305): hitshipo_woo_pn_plugin_activation()
    #1 wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(470): WP_Hook->do_action()
    #3 wp-admin/includes/plugin.php(725): do_action()

Server metrics [RAM: ▲0.01MB] [CPU: ▼144.24ms] Passed 4 tests

Analyzing server-side resources used by Automated PostNord label and pickup
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.1232.88 ▲6.00
Dashboard /wp-admin3.06 ▲0.0143.08 ▼3.18
Posts /wp-admin/edit.php3.15 ▲0.0445.52 ▼0.87
Add New Post /wp-admin/post-new.php5.43 ▼0.0196.40 ▼564.85
Media Library /wp-admin/upload.php3.01 ▲0.0033.84 ▼8.06

Server storage [IO: ▲8.42MB] [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, no new options

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 /3,703 ▲10716.01 ▲0.439.94 ▲0.5642.31 ▼7.13
Dashboard /wp-admin2,973 ▲395.88 ▼0.10161.16 ▼9.39106.04 ▼17.36
Posts /wp-admin/edit.php2,739 ▼02.71 ▼0.0165.61 ▼8.6887.83 ▼0.58
Add New Post /wp-admin/post-new.php1,498 ▼218.85 ▲0.32394.53 ▼16.46102.55 ▼6.71
Media Library /wp-admin/upload.php1,807 ▼05.04 ▲0.04157.42 ▲2.00112.09 ▼4.03

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 | 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 'Monolog\\Processor\\ProcessorInterface' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php:23
    • > 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/Type/Money.php:16
    • > 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
    • > 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/Distribution/BucketOptions/Linear.php:22
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Event\\SubscriberInterface' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/auth/src/Subscriber/SimpleSubscriber.php:30
    • > 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/QuotaFailure.php:24
    • > 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/PreconditionFailure.php:19
    • > 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/AuthRequirement.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Grpc\\UnaryCall' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/gax/src/Testing/MockUnaryCall.php:45
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/automated-postnord-shipping/controllors/classes/gtrans/vendor/google/protobuf/src/Google/Protobuf/Struct.php:22

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.0.1 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:
  • Requires at least: Required version must match the one declared in readme.txt ("4.0.1" instead of "2.6")
  • 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")
  • 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,405 lines of code in 1,291 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,18816,27571,34073,299
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.24
Average class complexity5.70
▷ Minimum class complexity1.00
▷ Maximum class complexity463.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,440
▷ Static methods5628.73%
▷ Public methods5,70988.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%
pn.png119.73KB45.66KB▼ 61.87%
controllors/views/pn.png101.22KB38.30KB▼ 62.16%