83% ecpay-payment-for-woocommerce

Code Review | ECPay Payment for WooCommerce

WordPress plugin ECPay Payment for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: ecpay-payment-for...
  • Plugin version: 2.0.2106300
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-5.7.1
  • WordPress version: 6.3.1
  • First release: Mar 16, 2018
  • Latest release: Jun 2, 2022
  • Number of updates: 38
  • Update frequency: every 40.5 days
  • Top authors: ecpaytechsupport (100%)

Code review

54 tests

User reviews

1 review

Install metrics

3,000+ active /33,975 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼2.93ms] Passed 4 tests

Analyzing server-side resources used by ECPay Payment for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0441.97 ▼7.60
Dashboard /wp-admin3.34 ▲0.0452.34 ▼1.10
Posts /wp-admin/edit.php3.39 ▲0.0455.36 ▼0.67
Add New Post /wp-admin/post-new.php5.92 ▲0.0494.15 ▼2.33
Media Library /wp-admin/upload.php3.27 ▲0.0438.57 ▲2.82

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

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

Browser metrics Passed 4 tests

A check of browser resources used by ECPay Payment for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,809 ▲7413.24 ▼1.501.83 ▼0.3039.56 ▼2.34
Dashboard /wp-admin2,209 ▲215.85 ▼0.0497.94 ▼14.8938.35 ▼5.08
Posts /wp-admin/edit.php2,097 ▲82.02 ▼0.0442.18 ▼0.3636.65 ▼1.87
Add New Post /wp-admin/post-new.php1,539 ▲623.45 ▲0.04598.05 ▼97.2749.59 ▼4.46
Media Library /wp-admin/upload.php1,394 ▲64.28 ▲0.0998.21 ▼14.1243.31 ▼0.34

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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 take a closer look at the following
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/ecpay-payment-for-woocommerce/includes/class-wc-gateway-ecpay.php:3

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)
There were no browser issues found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed: The official readme.txt might help

ecpay-payment-for-woocommerce/integration_plugin.php 85% from 13 tests

The principal PHP file in "ECPay Payment for WooCommerce" v. 2.0.2106300 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Requires at least: Required version does not match the one declared in readme.txt ("4.5" instead of "3.1")
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("ecpay-payment-for-woocommerce.php" instead of "integration_plugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin4,613 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP139731,6744,196
JavaScript26316220
PO File1690155
CSS11042

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity7.87
▷ Minimum class complexity1.00
▷ Maximum class complexity97.00
Average method complexity3.00
▷ Minimum method complexity1.00
▷ Maximum method complexity67.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes69
▷ Abstract classes2434.78%
▷ Concrete classes4565.22%
▷ Final classes12.22%
Methods240
▷ Static methods4920.42%
▷ Public methods18978.75%
▷ Protected methods187.50%
▷ Private methods3313.75%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants98
▷ Global constants66.12%
▷ Class constants9293.88%
▷ Public constants92100.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/icon.png2.62KB2.09KB▼ 20.22%