62% kiotvietsync

Code Review | KiotViet Sync

WordPress plugin KiotViet Sync scored62%from 54 tests.

About plugin

  • Plugin page: kiotvietsync
  • Plugin version: 1.6.87
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.0
  • WordPress version: 6.3.1
  • First release: Jul 4, 2019
  • Latest release: Nov 25, 2023
  • Number of updates: 137
  • Update frequency: every 11.7 days
  • Top authors: mykiot (78.1%)tuyenvv92 (14.6%)hoangbach96 (8.76%)

Code review

54 tests

User reviews

15 reviews

Install metrics

900+ active /16,964 total downloads

Benchmarks

Plugin footprint 65% 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: ▲1.41MB] [CPU: ▲8.95ms] Passed 4 tests

This is a short check of server-side resources used by KiotViet Sync
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.87 ▲1.4049.86 ▲8.66
Dashboard /wp-admin4.72 ▲1.4162.85 ▲10.76
Posts /wp-admin/edit.php4.77 ▲1.4160.40 ▲10.09
Add New Post /wp-admin/post-new.php7.31 ▲1.42100.62 ▲6.30
Media Library /wp-admin/upload.php4.65 ▲1.4149.31 ▲15.30
Thiết lập thông tin đồng bộ /wp-admin/admin.php?page=plugin-kiotviet-sync4.5545.54
Cài đặt plugin /wp-admin/plugins.php?page=tgmpa-install-plugins4.7541.91
Danh sách đơn đặt hàng /wp-admin/admin.php?page=plugin-kiotviet-sync-order4.6440.57
Danh sách webhook /wp-admin/admin.php?page=plugin-kiotviet-sync-webhook4.6443.35
Lịch sử đồng bộ /wp-admin/admin.php?page=plugin-kiotviet-sync-history4.6344.99
Cài đặt /wp-admin/admin.php?page=plugin-kiotviet-sync-options4.7643.14
Danh sách sản phẩm đồng bộ /wp-admin/admin.php?page=plugin-kiotviet-sync-product4.6443.34

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 200 new files
Database: 4 new tables, 7 new options
New tables
wp_kiotviet_sync_categories
wp_kiotviet_sync_logs
wp_kiotviet_sync_orders
wp_kiotviet_sync_products
New WordPress options
widget_recent-posts
db_upgraded
recovery_mode_email_last_sent
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by KiotViet Sync
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,881 ▲11914.68 ▼0.031.88 ▲0.1039.26 ▼6.63
Dashboard /wp-admin2,261 ▲815.64 ▼0.0498.01 ▲5.5351.81 ▲7.33
Posts /wp-admin/edit.php2,175 ▲752.02 ▼0.0041.67 ▲0.9946.30 ▲11.40
Add New Post /wp-admin/post-new.php1,580 ▲5423.25 ▼0.10622.04 ▼34.1951.11 ▲0.35
Media Library /wp-admin/upload.php1,474 ▲714.20 ▲0.0196.44 ▼0.3451.71 ▲11.20
Thiết lập thông tin đồng bộ /wp-admin/admin.php?page=plugin-kiotviet-sync1,0735.81104.4970.26
Cài đặt plugin /wp-admin/plugins.php?page=tgmpa-install-plugins1,0102.0626.9641.09
Danh sách đơn đặt hàng /wp-admin/admin.php?page=plugin-kiotviet-sync-order7571.126.5735.42
Danh sách webhook /wp-admin/admin.php?page=plugin-kiotviet-sync-webhook9024.1775.1336.01
Lịch sử đồng bộ /wp-admin/admin.php?page=plugin-kiotviet-sync-history1,0394.1585.0537.12
Cài đặt /wp-admin/admin.php?page=plugin-kiotviet-sync-options9754.2676.3842.08
Danh sách sản phẩm đồng bộ /wp-admin/admin.php?page=plugin-kiotviet-sync-product1,0214.1480.7335.36

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 4 tables in the database
    • wp_kiotviet_sync_categories
    • wp_kiotviet_sync_orders
    • wp_kiotviet_sync_products
    • wp_kiotviet_sync_logs
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • recovery_mode_email_last_sent
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=plugin-kiotviet-sync-order
    • > Error in wp-content/plugins/kiotvietsync/admin/list_table/order.php+88
    Uncaught Error: Call to undefined function wc_orders_count() in wp-content/plugins/kiotvietsync/admin/list_table/order.php:88
    Stack trace:
    #0 wp-content/plugins/kiotvietsync/admin/views/order.php(6): Kv_Orders_List->prepare_items()
    #1 wp-content/plugins/kiotvietsync/admin/class-kiotviet-sync-admin.php(114): include_once('/var/www/wordpr...')
    #2 wp-includes/class-wp-hook.php(310): Kiotviet_Sync_Admin->action_kiotvietsync_order()
    #3 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #4 wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 wp-admin/admin.php(259): do_action()
    #6 {main}
    thrown

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
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/kiotvietsync/admin/partials/kiotviet-sync-admin-display.php
    • > /wp-content/plugins/kiotvietsync/admin/views/kiotviet-sync-admin-display.php
  • 79× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/kiotvietsync/admin/list_table/log.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'StubsGenerator\\Finder' not found in wp-content/plugins/kiotvietsync/vendor/php-stubs/woocommerce-stubs/finder-packages.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/kiotvietsync/vendor/guzzlehttp/psr7/src/Stream.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/kiotvietsync/vendor/psr/http-message/src/RequestInterface.php:24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/kiotvietsync/includes/services/class-kiotviet-sync-services-order.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/kiotvietsync/includes/public_actions/admin/controllers/QueryControllerAdmin.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/kiotvietsync/includes/services/class-kiotviet-sync-services-pricebooks.php:2
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\TaskQueueInterface' not found in wp-content/plugins/kiotvietsync/vendor/guzzlehttp/promises/src/TaskQueue.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/kiotvietsync/vendor/guzzlehttp/psr7/src/BufferStream.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/kiotvietsync/vendor/guzzlehttp/psr7/src/MultipartStream.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (https://www.kiotviet.vn/wp-content/uploads/2019/07/Screenshot1.png), #2 (https://www.kiotviet.vn/wp-content/uploads/2019/07/Screenshot2.png), #3 (https://www.kiotviet.vn/wp-content/uploads/2019/07/Screenshot3.png)
The official readme.txt is a good inspiration

kiotvietsync/kiotviet-sync.php 85% from 13 tests

The primary PHP file in "KiotViet Sync" version 1.6.87 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("kiotvietsync.php" instead of "kiotviet-sync.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected75,439 lines of code in 178 files:
LanguageFilesBlank linesComment linesLines of code
PHP1463,147160,50771,181
Markdown111,00703,219
JSON1000687
CSS2220126
Sass1124126
Bourne Shell2162354
XML14018
YAML14014
make1409
JavaScript22284
HTML1001

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity2.33
▷ Minimum class complexity1.00
▷ Maximum class complexity206.00
Average method complexity1.14
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces69
Interfaces51
Traits10
Classes1,385
▷ Abstract classes735.27%
▷ Concrete classes1,31294.73%
▷ Final classes493.73%
Methods13,177
▷ Static methods2,04215.50%
▷ Public methods10,43579.19%
▷ Protected methods2,06315.66%
▷ Private methods6795.15%
Functions4,205
▷ Named functions4,11597.86%
▷ Anonymous functions902.14%
Constants522
▷ Global constants61.15%
▷ Class constants51698.85%
▷ Public constants516100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin