56% mojito-shipping

Code Review | Mojito Shipping

WordPress plugin Mojito Shipping scored 56% from 54 tests.

About plugin

  • Plugin page: mojito-shipping
  • Plugin version: 1.4.4
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.2.2
  • WordPress version: 6.3.1
  • First release: Mar 11, 2020
  • Latest release: Aug 3, 2023
  • Number of updates: 53
  • Update frequency: every 23.4 days
  • Top authors: marodok (83.02%)quantumdev (18.87%)

Code review

54 tests

User reviews

4 reviews

Install metrics

80+ active / 3,774 total downloads

Benchmarks

Plugin footprint 64% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲6.14MB] [CPU: ▲31.66ms] 75% from 4 tests

Server-side resources used by Mojito Shipping
It is recommended to improve the following
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 6.14MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.69 ▲6.2379.05 ▲36.94
Dashboard /wp-admin9.71 ▲6.4180.54 ▲25.96
Posts /wp-admin/edit.php9.71 ▲6.3587.91 ▲39.14
Add New Post /wp-admin/post-new.php11.44 ▲5.56127.88 ▲38.70
Media Library /wp-admin/upload.php9.71 ▲6.4879.20 ▲25.05
Mojito Shipping /wp-admin/options-general.php?page=mojito-shipping9.7170.75
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius9.7165.16

Server storage [IO: ▲35.47MB] [DB: ▲0.15MB] 67% from 3 tests

Input-output and database impact of this plugin
Please try to fix the following items
  • Total filesystem usage must be limited to 25MB (currently using 35.47MB)
Filesystem: 639 new files
Database: no new tables, 11 new options
New WordPress options
db_upgraded
fs_active_plugins
widget_recent-posts
mojito-shipping-pymexpress-preloaded
widget_theysaidso_widget
theysaidso_admin_options
fs_accounts
fs_debug_mode
widget_recent-comments
woocommerce_default_country
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Mojito Shipping
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,939 ▲18213.77 ▼0.985.08 ▲2.9029.90 ▼17.45
Dashboard /wp-admin2,240 ▲495.00 ▲0.09111.98 ▲8.8541.05 ▼2.31
Posts /wp-admin/edit.php2,120 ▲342.50 ▲0.5341.95 ▲4.2241.01 ▲6.41
Add New Post /wp-admin/post-new.php1,531 ▲1723.43 ▲5.84689.08 ▲10.6561.63 ▲8.73
Media Library /wp-admin/upload.php1,416 ▲284.43 ▲0.1498.66 ▼4.6146.49 ▲4.61
Mojito Shipping /wp-admin/options-general.php?page=mojito-shipping1,0341.8526.9057.93
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,0941.9027.1128.87

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/mojito-shipping/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • This plugin does not fully uninstall, leaving 11 options in the database
    • mojito-shipping-pymexpress-preloaded
    • woocommerce_default_country
    • fs_debug_mode
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • fs_accounts
    • db_upgraded
    • fs_active_plugins
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means 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
Please fix the following
  • 84× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_014.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_026.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_051.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_055.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_036.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_039.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_023.php
    • > /wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_022.php
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function bcadd() in wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/tcpdf_barcodes_1d.php:2080
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shipping_Method' not found in wp-content/plugins/mojito-shipping/includes/class-mojito-shipping-method-glovo.php:17
    • > PHP Warning
      require_once(wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_066.php on line 22
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/example_066.php on line 22

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Donate link: Invalid url: ""
The official readme.txt is a good inspiration

mojito-shipping/mojito-shipping.php 92% from 13 tests

"Mojito Shipping" version 1.4.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Requires at least: The required version number must match the one declared in readme.txt ("4.6" instead of "5.2")

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
It is important to fix the following items
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/mojito-shipping/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt
117,594 lines of code in 436 files:
LanguageFilesBlank linesComment linesLines of code
PHP38413,67238,50696,860
PO File147,78410,40717,386
SVG7111,915
JavaScript6193124707
CSS1504279
Markdown2890277
JSON700169
YAML1001

PHP code 0% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
These items need your attention
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 4,415)
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 500)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity132.67
▷ Minimum class complexity1.00
▷ Maximum class complexity4,415.00
Average method complexity6.54
▷ Minimum method complexity1.00
▷ Maximum method complexity500.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes91
▷ Abstract classes22.20%
▷ Concrete classes8997.80%
▷ Final classes00.00%
Methods2,171
▷ Static methods32514.97%
▷ Public methods1,47267.80%
▷ Protected methods29513.59%
▷ Private methods40418.61%
Functions119
▷ Named functions10386.55%
▷ Anonymous functions1613.45%
Constants284
▷ Global constants23783.45%
▷ Class constants4716.55%
▷ Public constants47100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
9 PNG files occupy 0.58MB with 0.16MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/tecnickcom/tcpdf/examples/images/_blank.png0.13KB0.09KB▼ 30.66%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
vendor/tecnickcom/tcpdf/examples/images/alpha.png23.30KB30.34KB0.00%
vendor/tecnickcom/tcpdf/examples/images/logo_example.png17.41KB17.68KB0.00%
vendor/tecnickcom/tcpdf/examples/images/tcpdf_signature.png66.18KB25.47KB▼ 61.51%