84% onepay-payment-gateway-for-woocommerce

Code Review | onepay Payment Gateway For WooCommerce

WordPress plugin onepay Payment Gateway For WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: onepay-payment-ga...
  • Plugin version: 1.0.3
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Sep 2, 2021
  • Latest release: Feb 2, 2023
  • Number of updates: 6
  • Update frequency: every 86.5 days
  • Top authors: onepay (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

800+ active /3,698 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.05MB] [CPU: ▼10.49ms] Passed 4 tests

An overview of server-side resources used by onepay Payment Gateway For WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0639.92 ▼5.59
Dashboard /wp-admin3.37 ▲0.0249.23 ▼17.46
Posts /wp-admin/edit.php3.42 ▲0.0647.22 ▼3.16
Add New Post /wp-admin/post-new.php5.95 ▲0.0687.22 ▼14.79
Media Library /wp-admin/upload.php3.29 ▲0.0638.35 ▼4.11

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
can_compress_scripts
widget_recent-posts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

onepay Payment Gateway For WooCommerce: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.27 ▼0.071.97 ▲0.3944.50 ▲3.78
Dashboard /wp-admin2,195 ▲155.63 ▼0.0490.91 ▲1.0438.41 ▼5.22
Posts /wp-admin/edit.php2,097 ▼32.14 ▲0.1535.57 ▼1.1035.37 ▼1.81
Add New Post /wp-admin/post-new.php1,531 ▼622.65 ▲4.25666.16 ▲22.6847.16 ▼9.81
Media Library /wp-admin/upload.php1,397 ▼34.18 ▼0.0594.79 ▼12.8245.61 ▼2.76

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options

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)
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/onepay-payment-gateway-for-woocommerce/index.php:13

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Contributors: The plugin contributors field is missing
You can look at the official readme.txt

onepay-payment-gateway-for-woocommerce/index.php 92% from 13 tests

The main PHP script in "onepay Payment Gateway For WooCommerce" version 1.0.3 is automatically included on every request by WordPress
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("onepay-payment-gateway-for-woocommerce.php" instead of "index.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 detected293 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP110559293

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity33.00
▷ Minimum class complexity33.00
▷ Maximum class complexity33.00
Average method complexity4.56
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods9
▷ Static methods00.00%
▷ Public methods9100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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
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
assets/img/logo_onepay.png30.54KB9.77KB▼ 68.01%