93% nmi-payment-gateway-for-woocommerce

Code Review | NMI Payment Gateway for WooCommerce

WordPress plugin NMI Payment Gateway for WooCommerce scored 93% from 54 tests.

About plugin

  • Plugin page: nmi-payment-gatew...
  • Plugin version: 1.0.3
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.1.0
  • WordPress version: 5.8.1
  • First release: Mar 25, 2019
  • Latest release: Mar 25, 2019
  • Number of updates: 2
  • Update frequency: every 11.0 days
  • Top authors: sahilbabu (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active / 490 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

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

This is a short check of server-side resources used by NMI Payment Gateway for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.0038.75 ▲1.44
Dashboard /wp-admin3.06 ▲0.0157.65 ▲12.05
Posts /wp-admin/edit.php3.11 ▲0.0050.37 ▼0.71
Add New Post /wp-admin/post-new.php5.42 ▼0.02102.06 ▼570.67
Media Library /wp-admin/upload.php3.00 ▲0.0035.30 ▲0.51

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 11 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by NMI Payment Gateway for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,703 ▲10716.15 ▲0.609.90 ▼0.9660.72 ▲7.94
Dashboard /wp-admin2,973 ▲426.10 ▼0.07144.87 ▼10.22125.05 ▲5.96
Posts /wp-admin/edit.php2,739 ▼02.72 ▲0.0076.44 ▲4.0299.02 ▲14.51
Add New Post /wp-admin/post-new.php1,676 ▼718.86 ▲0.13395.01 ▲7.36120.07 ▲5.11
Media Library /wp-admin/upload.php1,807 ▼35.05 ▲0.03166.25 ▲4.36129.56 ▲0.36

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

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

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 fix the following
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway_CC' not found in wp-content/plugins/nmi-payment-gateway-for-woocommerce/includes/NMI_Payment_Gateway_CC.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Screenshots: Add images for these screenshots: #1 (woo-nmi-payment-gateway-screenshot-1), #2 (woo-nmi-payment-gateway-screenshot-2), #3 (woo-nmi-payment-gateway-screenshot-3)
The official readme.txt is a good inspiration

nmi-payment-gateway-for-woocommerce/woo-nmi-payment-gateway.php 85% from 13 tests

"NMI Payment Gateway for WooCommerce" version 1.0.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("nmi-payment-gateway-for-woocommerce.php" instead of "woo-nmi-payment-gateway.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected1,042 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP33192511,042

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity89.00
▷ Minimum class complexity4.00
▷ Maximum class complexity174.00
Average method complexity7.52
▷ Minimum method complexity1.00
▷ Maximum method complexity99.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods27
▷ Static methods311.11%
▷ Public methods2074.07%
▷ Protected methods00.00%
▷ Private methods725.93%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants150.00%
▷ Class constants150.00%
▷ Public constants1100.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
6 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/card-visa.png4.73KB1.66KB▼ 64.98%
assets/images/card-dc.png6.16KB1.85KB▼ 70.00%
assets/images/card-amex.png4.45KB1.65KB▼ 62.79%
assets/images/card-disc.png4.49KB1.47KB▼ 67.30%
assets/images/card-jcb.png5.54KB1.72KB▼ 69.02%