83% midtrans-woocommerce

Code Review | Midtrans-WooCommerce

WordPress plugin Midtrans-WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: midtrans-woocommerce
  • Plugin version: 2.32.2
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0.0-6.1
  • WordPress version: 6.3.1
  • First release: Oct 12, 2016
  • Latest release: Jan 2, 2023
  • Number of updates: 98
  • Update frequency: every 23.2 days
  • Top authors: rizdaprasetya (56.12%)yocki (44.9%)

Code review

54 tests

User reviews

3 reviews

Install metrics

6,000+ active /88,782 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼9.81ms] Passed 4 tests

Server-side resources used by Midtrans-WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0343.68 ▼2.21
Dashboard /wp-admin3.33 ▼0.0151.38 ▼11.61
Posts /wp-admin/edit.php3.39 ▲0.0349.19 ▼1.97
Add New Post /wp-admin/post-new.php5.92 ▲0.0384.86 ▼23.45
Media Library /wp-admin/upload.php3.26 ▲0.0237.00 ▲0.05

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 103 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Midtrans-WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.45 ▲0.101.66 ▼0.1446.14 ▲2.85
Dashboard /wp-admin2,198 ▲185.63 ▲0.0182.30 ▼8.0040.52 ▼2.57
Posts /wp-admin/edit.php2,100 ▲31.95 ▼0.0935.93 ▼2.9931.13 ▼1.34
Add New Post /wp-admin/post-new.php1,526 ▼1123.18 ▼0.29702.35 ▲41.0865.38 ▲12.70
Media Library /wp-admin/upload.php1,403 ▼04.20 ▲0.0397.00 ▼12.9544.14 ▼3.91

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments

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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 12× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Order' not found in wp-content/plugins/midtrans-woocommerce/class/order-view-and-thankyou-page.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Gateway_Midtrans_Abstract' not found in wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-installmentoff.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Gateway_Midtrans_Abstract' not found in wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway.php:31
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/midtrans-woocommerce/lib/midtrans/vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/midtrans-woocommerce/lib/midtrans/test_bootstrap.php on line 6
    • > PHP Warning
      require_once(wp-content/plugins/midtrans-woocommerce/lib/midtrans/vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/midtrans-woocommerce/lib/midtrans/test_bootstrap.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Gateway_Midtrans_Abstract' not found in wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-installment.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Midtrans_Utils' not found in wp-content/plugins/midtrans-woocommerce/class/payment-page.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Gateway_Midtrans_Abstract' not found in wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-promo.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Gateway_Midtrans_Abstract' not found in wp-content/plugins/midtrans-woocommerce/class/class.midtrans-gateway-paymentrequest.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/midtrans-woocommerce/class/finish-url-page.php:26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
9 plugin tags: veritrans, payment, e-commerce, woocommerce, commerce...

midtrans-woocommerce/midtrans-gateway.php 77% from 13 tests

The main PHP script in "Midtrans-WooCommerce" version 2.32.2 is automatically included on every request by WordPress
The following require your attention:
  • Requires at least: The required version number did not match the one declared in readme.txt ("3.9.1" instead of "2.0.0")
  • Main file name: Name the main plugin file the same as the plugin slug ("midtrans-woocommerce.php" instead of "midtrans-gateway.php")
  • Description: The description should be shorter than 140 characters (currently 165 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin3,859 lines of code in 56 files:
LanguageFilesBlank linesComment linesLines of code
PHP464211,2972,900
Markdown41750634
JavaScript42241262
JSON10034
XML10029

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity7.57
▷ Minimum class complexity1.00
▷ Maximum class complexity72.00
Average method complexity2.06
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes37
▷ Abstract classes25.41%
▷ Concrete classes3594.59%
▷ Final classes00.00%
Methods233
▷ Static methods5121.89%
▷ Public methods16771.67%
▷ Protected methods5523.61%
▷ Private methods114.72%
Functions8
▷ Named functions562.50%
▷ Anonymous functions337.50%
Constants4
▷ Global constants00.00%
▷ Class constants4100.00%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
40 PNG files occupy 0.20MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/images/payment-methods/alt_alfamart_2.png4.60KB2.62KB▼ 43.08%
public/images/payment-methods/alt_mandiri_clickpay.png10.53KB4.15KB▼ 60.58%
public/images/payment-methods/bca_klikpay.png2.59KB2.30KB▼ 11.24%
public/images/payment-methods/credit_card.png0.73KB0.53KB▼ 27.31%
public/images/payment-methods/qris.png3.23KB2.85KB▼ 11.77%