78% posti-shipping

Code Review | Posti Shipping

WordPress plugin Posti Shipping scored78%from 54 tests.

About plugin

  • Plugin page: posti-shipping
  • Plugin version: 3.9.3
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Aug 20, 2020
  • Latest release: Sep 20, 2023
  • Number of updates: 42
  • Update frequency: every 27.5 days
  • Top authors: jooseposti (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

600+ active /10,541 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.27MB] [CPU: ▼7.57ms] Passed 4 tests

An overview of server-side resources used by Posti Shipping
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.74 ▲0.2837.11 ▼3.35
Dashboard /wp-admin3.58 ▲0.2745.87 ▲0.67
Posts /wp-admin/edit.php3.63 ▲0.2744.09 ▼5.76
Add New Post /wp-admin/post-new.php6.16 ▲0.2779.69 ▼21.84
Media Library /wp-admin/upload.php3.50 ▲0.2737.30 ▲4.98

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

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

Browser metrics Passed 4 tests

Posti Shipping: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,792 ▲614.17 ▼0.181.74 ▼0.1939.72 ▼0.04
Dashboard /wp-admin2,198 ▲215.55 ▼0.1182.21 ▼13.2437.68 ▼1.71
Posts /wp-admin/edit.php2,103 ▲62.01 ▲0.0333.82 ▼2.2536.17 ▲4.98
Add New Post /wp-admin/post-new.php1,529 ▲323.17 ▲0.11655.03 ▲8.2161.99 ▲14.39
Media Library /wp-admin/upload.php1,403 ▲34.17 ▼0.0595.32 ▲2.8441.90 ▲2.00

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts

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
The following issues need your attention
  • 10× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/estimate-price.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/get-shipment-status.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/log-api-requests.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/list-shipping-methods.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/create-shipment.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/get-pickup-point-info.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/search-pickup-points-text.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/find-city-by-postcode.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/list-additional-services.php
    • > /wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/search-pickup-points.php
  • 30× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Woo_Pakettikauppa_Core\\Shipment' not found in wp-content/plugins/posti-shipping/posti_shipping/classes/class-shipment.php:5
    • > PHP Fatal error
      require(): Failed opening required '../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/list-shipping-methods.php on line 10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/src/Tests/Pakettikauppa/ClientTest.php:8
    • > PHP Warning
      require(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/find-city-by-postcode.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr__() in wp-content/plugins/posti-shipping/templates/pakettikauppa/tracking-email-txt.php:13
    • > PHP Fatal error
      require(): Failed opening required '../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/get-shipment-status.php on line 9
    • > PHP Fatal error
      require(): Failed opening required '../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/search-pickup-points-text.php on line 6
    • > PHP Warning
      require(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/search-pickup-points-text.php on line 6
    • > PHP Fatal error
      require(): Failed opening required '../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/get-pickup-point-info.php on line 5
    • > PHP Warning
      require(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/posti-shipping/vendor/pakettikauppa/api-library/examples/get-pickup-point-info.php on line 5

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 93% 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
7 plugin tags: prinetti, toimitustavat, smartpost, shipping, posti...

posti-shipping/posti-shipping.php 85% from 13 tests

"Posti Shipping" version 3.9.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Domain Path: The domain path is invalid: folder "/languages/" does not exist
  • Text Domain: The text domain name should consist of only dashes and lowercase characters

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin13,190 lines of code in 81 files:
LanguageFilesBlank linesComment linesLines of code
PHP501,6232,1357,989
PO File61,2711,5433,275
CSS78413808
JavaScript611013694
JSON310159
XML33564118
Markdown350085
YAML351862

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity34.10
▷ Minimum class complexity1.00
▷ Maximum class complexity262.00
Average method complexity2.64
▷ Minimum method complexity1.00
▷ Maximum method complexity61.00
Code structure
Namespaces7
Interfaces0
Traits0
Classes30
▷ Abstract classes13.33%
▷ Concrete classes2996.67%
▷ Final classes00.00%
Methods563
▷ Static methods295.15%
▷ Public methods49688.10%
▷ Protected methods173.02%
▷ Private methods508.88%
Functions28
▷ Named functions00.00%
▷ Anonymous functions28100.00%
Constants2
▷ Global constants00.00%
▷ Class constants2100.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
7 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
.github/travis-ci-manual-trigger.png19.37KB9.48KB▼ 51.07%
assets/img/pakettikauppa-logo-black.png2.78KB1.24KB▼ 55.38%
assets/img/posti-logo.png1.85KB1.05KB▼ 43.39%
posti_shipping/assets/img/posti-logo.png1.85KB1.05KB▼ 43.39%
.github/travis-ci-sync.png4.08KB2.59KB▼ 36.49%