61% b2w-skyhub

Code Review | SkyHub's Integration

WordPress plugin SkyHub's Integration scored 61% from 54 tests.

About plugin

  • Plugin page: b2w-skyhub
  • Plugin version: 0.2.21
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.5.1
  • WordPress version: 5.8.1
  • First release: Jun 6, 2019
  • Latest release: Nov 21, 2021
  • Number of updates: 57
  • Update frequency: every 16.2 days
  • Top authors: bitservices (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

200+ active / 5,580 total downloads

Benchmarks

Plugin footprint 64% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.01MB] [CPU: ▼152.65ms] 75% from 4 tests

An overview of server-side resources used by SkyHub's Integration
Please fix the following
  • CPU: Total CPU usage must kept under 500.00ms (currently 624.14ms on /wp-admin/admin.php?page=woocommerce-b2w-skyhub)
PageMemory (MB)CPU Time (ms)
Home /2.87 ▲0.0427.70 ▲5.34
Dashboard /wp-admin3.21 ▲0.1537.52 ▼2.73
Posts /wp-admin/edit.php3.26 ▲0.1538.88 ▲4.47
Add New Post /wp-admin/post-new.php5.12 ▼0.3253.40 ▼612.52
Media Library /wp-admin/upload.php3.09 ▲0.0925.83 ▲0.19
Product Attributes /wp-admin/admin.php?page=catalog-product-list3.2025.29
Product Attribute Edit /wp-admin/admin.php?page=catalog-product-edit3.1221.77
Settings API /wp-admin/admin.php?page=settings-api-view3.1527.90
Queue Integration /wp-admin/admin.php?page=queue-integration-skyhub-list3.1523.61
SkyHub /wp-admin/admin.php?page=woocommerce-b2w-skyhub3.60624.14
Log Integration Error /wp-admin/admin.php?page=log-integracao-skyhub-list3.1124.78
Customer Attributes /wp-admin/admin.php?page=sales-order-customer-list3.1322.40
Customer Attribute Edit /wp-admin/admin.php?page=sales-order-customer-edit3.0621.65
Customer Attribute Edit /wp-admin/admin.php?page=sales-order-address-edit3.1120.21
Address Attributes /wp-admin/admin.php?page=sales-order-address-list3.1025.32

Server storage [IO: ▲2.07MB] [DB: ▲0.00MB] 67% from 3 tests

Filesystem and database footprint
Please fix the following
  • You have illegally modified 1 file (0.00KB) outside of "wp-content/plugins/b2w-skyhub/" and "wp-content/uploads/"
    • (new file) var/log/.empty
Filesystem: 756 new files
Database: 2 new tables, 1 new option
New tables
wp_woocommerce_b2w_skyhub_log
wp_woocommerce_b2w_skyhub_queue
New WordPress options
recovery_mode_email_last_sent

Browser metrics Passed 4 tests

A check of browser resources used by SkyHub's Integration
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,725 ▲12415.68 ▲0.137.29 ▲0.1974.90 ▼1.68
Dashboard /wp-admin2,989 ▲936.16 ▲0.12113.51 ▼16.57168.42 ▼9.56
Posts /wp-admin/edit.php2,803 ▲663.24 ▲0.0163.61 ▼0.91136.38 ▼1.07
Add New Post /wp-admin/post-new.php3,850 ▲10818.92 ▲0.50426.63 ▼30.06162.01 ▼0.62
Media Library /wp-admin/upload.php1,809 ▲575.54 ▲0.04151.49 ▲10.45194.81 ▲10.13
Product Attributes /wp-admin/admin.php?page=catalog-product-list1,4402.4855.20100.11
Product Attribute Edit /wp-admin/admin.php?page=catalog-product-edit9471.9836.9585.45
Settings API /wp-admin/admin.php?page=settings-api-view1,4732.4952.12122.38
Queue Integration /wp-admin/admin.php?page=queue-integration-skyhub-list1,2732.4252.0197.98
SkyHub /wp-admin/admin.php?page=woocommerce-b2w-skyhub9301.9738.8873.98
Log Integration Error /wp-admin/admin.php?page=log-integracao-skyhub-list1,1212.3663.99107.43
Customer Attributes /wp-admin/admin.php?page=sales-order-customer-list1,3392.4157.05100.37
Customer Attribute Edit /wp-admin/admin.php?page=sales-order-customer-edit9471.9837.8085.49
Customer Attribute Edit /wp-admin/admin.php?page=sales-order-address-edit9471.9836.6984.92
Address Attributes /wp-admin/admin.php?page=sales-order-address-list1,4142.5554.43101.30

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 50% 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 plugin did not uninstall successfully, leaving 2 tables in the database
    • wp_woocommerce_b2w_skyhub_log
    • wp_woocommerce_b2w_skyhub_queue
  • This plugin does not fully uninstall, leaving 1 option in the database
    • recovery_mode_email_last_sent

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sales-order-address-edit
    • > Error in wp-content/plugins/b2w-skyhub/view/admin/attribute/edit.php+11
    Uncaught Error: Call to a member function getLabel() on null in wp-content/plugins/b2w-skyhub/view/admin/attribute/edit.php:11
    Stack trace:
    #0 wp-content/plugins/b2w-skyhub/B2W/SkyHub/View/Template.php(53): include()
    #1 wp-includes/class-wp-hook.php(303): B2W\SkyHub\View\Template->render()
    #2 wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(470): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=woocommerce-b2w-skyhub
    • > Error in wp-content/plugins/b2w-skyhub/B2W/SkyHub/Model/Repository/Order/StatusApiRepository.php+35
    Uncaught B2W\SkyHub\Exception\ApiException: Client error response [url] https://api.skyhub.com.br/statuses [status code] 401 [reason phrase] Unauthorized in wp-content/plugins/b2w-skyhub/B2W/SkyHub/Model/Repository/Order/StatusApiRepository.php:35
    Stack trace:
    #0 wp-content/plugins/b2w-skyhub/B2W/SkyHub/Model/Map/Order/StatusMap.php(50): B2W\SkyHub\Model\Repository\Order\StatusApiRepository->all()
    #1 wp-content/plugins/b2w-skyhub/B2W/SkyHub/Model/Map/MapAbstract.php(45): B2W\SkyHub\Model\Map\Order\StatusMap->_loadMap()
    #2 wp-content/plugins/b2w-skyhub/B2W/SkyHub/View/Admin/Sales/Order/Status/View.php(37): B2W\SkyHub\Model\Map\MapAbstract->map()
    #3 wp-content/plugins/b2w-skyhub/B2W/SkyHub/View/Admin/Form/FormAbstract.php(42): B2W\SkyHub\View\Admin\Sales\Order\Status\View->_prepareForm()
    #4 wp-includes/class-wp-hook.php(303): B2W\SkyHub\View\Admin\Form\FormAbstract->render()
    #5 wp

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/b2w-skyhub/vendor/bittools/skyhub-php/examples/sendNfeWithOrder.php
  • 472× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'SkyHub\\Api' not found in wp-content/plugins/b2w-skyhub/vendor/bittools/skyhub-php/examples/api.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Event\\SubscriberInterface' not found in wp-content/plugins/b2w-skyhub/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/b2w-skyhub/vendor/guzzlehttp/ringphp/tests/Client/StreamHandlerTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'B2W\\SkyHub\\Model\\Transformer\\DbToEntityAbstract' not found in wp-content/plugins/b2w-skyhub/B2W/SkyHub/Model/Transformer/Customer/DbToEntity.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Event\\AbstractRetryableEvent' not found in wp-content/plugins/b2w-skyhub/vendor/guzzlehttp/guzzle/src/Event/ErrorEvent.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'B2W\\SkyHub\\Model\\Queue\\MessageAbstract' not found in wp-content/plugins/b2w-skyhub/B2W/SkyHub/Model/Queue/Message/OrderDeliveryMessage.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'SkyHub\\Api\\DataTransformer\\DataTransformerAbstract' not found in wp-content/plugins/b2w-skyhub/vendor/bittools/skyhub-php/src/Api/DataTransformer/Catalog/Product/Attribute/Update.php:22
    • > PHP Fatal error
      Uncaught Error: Interface 'React\\Promise\\ExtendedPromiseInterface' not found in wp-content/plugins/b2w-skyhub/vendor/react/promise/src/Promise.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\MailHandler' not found in wp-content/plugins/b2w-skyhub/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'B2W\\SkyHub\\Model\\Transformer\\EntityToDbAbstract' not found in wp-content/plugins/b2w-skyhub/B2W/SkyHub/Model/Transformer/Order/Misc/PingStatus.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
8 plugin tags: integration, submarino, shoptime, integrao, woocommerce...

b2w-skyhub/woocommerce-b2w-skyhub.php 77% from 13 tests

The entry point to "SkyHub's Integration" version 0.2.21 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("b2w-skyhub.php" instead of "woocommerce-b2w-skyhub.php")
  • Domain Path: The domain path points to a folder that does not exist ("/i18n/languages/")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin42,993 lines of code in 732 files:
LanguageFilesBlank linesComment linesLines of code
PHP6699,02421,32737,375
Markdown301,14003,776
JSON910693
reStructuredText9263333517
make3415172
JavaScript11860163
YAML5253129
XML45078
PO File129171
Python14019

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity5.31
▷ Minimum class complexity1.00
▷ Maximum class complexity89.00
Average method complexity1.85
▷ Minimum method complexity1.00
▷ Maximum method complexity43.00
Code structure
Namespaces153
Interfaces74
Traits26
Classes521
▷ Abstract classes336.33%
▷ Concrete classes48893.67%
▷ Final classes40.82%
Methods3,692
▷ Static methods1514.09%
▷ Public methods3,07083.15%
▷ Protected methods46312.54%
▷ Private methods1594.31%
Functions309
▷ Named functions144.53%
▷ Anonymous functions29595.47%
Constants163
▷ Global constants31.84%
▷ Class constants16098.16%
▷ Public constants160100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
vendor/bittools/skyhub-php/doc/images/logo.png28.90KB10.07KB▼ 65.15%