83% pomelo-payment-gateway

Code Review | Pomelo Payment Gateway for WooCommerce

WordPress plugin Pomelo Payment Gateway for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: pomelo-payment-ga...
  • Plugin version: 1.0.3
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-5.7
  • WordPress version: 6.3.1
  • First release: Apr 12, 2021
  • Latest release: May 15, 2021
  • Number of updates: 16
  • Update frequency: every 44.0 days
  • Top authors: pomelopay (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /505 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.00MB] [CPU: ▼5.90ms] Passed 4 tests

An overview of server-side resources used by Pomelo Payment Gateway for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0138.73 ▼0.87
Dashboard /wp-admin3.31 ▼0.0356.30 ▼6.47
Posts /wp-admin/edit.php3.36 ▲0.0146.91 ▼1.49
Add New Post /wp-admin/post-new.php5.89 ▲0.0184.42 ▼14.77
Media Library /wp-admin/upload.php3.24 ▲0.0136.96 ▲3.86

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 189 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Pomelo Payment Gateway for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.86 ▲0.491.61 ▼0.6940.85 ▼3.42
Dashboard /wp-admin2,206 ▲184.85 ▼1.05113.76 ▲7.7237.12 ▼8.82
Posts /wp-admin/edit.php2,092 ▲32.04 ▼0.0035.45 ▼0.5034.56 ▲1.45
Add New Post /wp-admin/post-new.php1,530 ▲1623.16 ▲5.47697.42 ▲4.2262.43 ▲10.62
Media Library /wp-admin/upload.php1,385 ▼34.22 ▼0.0896.02 ▼6.3844.74 ▼0.84

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% 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
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 50× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Promise\\RejectionException' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/promises/src/AggregateException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/pomelo-payment-gateway/vendor/pomelopay/pomelopay-connect-php/test/ExpiresTest.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/promises/src/EachPromise.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/promises/src/Promise.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/psr7/src/FnStream.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/psr7/src/Stream.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/promises/src/RejectedPromise.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Polyfill\\Intl\ormalizer\ormalizer' not found in wp-content/plugins/pomelo-payment-gateway/vendor/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Promise\\RejectionException' not found in wp-content/plugins/pomelo-payment-gateway/vendor/guzzlehttp/promises/src/CancellationException.php:8

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 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Tags: There are too many tags (14 tag instead of maximum 10)
Please take inspiration from this readme.txt

pomelo-payment-gateway/pomelo-woocommerce.php 85% from 13 tests

"Pomelo Payment Gateway for WooCommerce" version 1.0.3'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:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("pomelo-payment-gateway.php" instead of "pomelo-woocommerce.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin32,359 lines of code in 174 files:
LanguageFilesBlank linesComment linesLines of code
PHP1392,3766,18727,512
Markdown151,16503,528
JSON1110957
XML200173
YAML427088
PO File1272782
Dockerfile18010
make1409

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity15.87
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity3.23
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces16
Interfaces15
Traits2
Classes95
▷ Abstract classes00.00%
▷ Concrete classes95100.00%
▷ Final classes2324.21%
Methods792
▷ Static methods14918.81%
▷ Public methods64080.81%
▷ Protected methods40.51%
▷ Private methods14818.69%
Functions160
▷ Named functions7043.75%
▷ Anonymous functions9056.25%
Constants165
▷ Global constants4124.85%
▷ Class constants12475.15%
▷ Public constants124100.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
No PNG images were found in this plugin