93% conditional-payments-for-woocommerce

Code Review | Conditional Payments for WooCommerce

WordPress plugin Conditional Payments for WooCommerce scored 93% from 53 tests.

About plugin

  • Plugin page: conditional-payme...
  • Plugin version: 2.2.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-5.8
  • WordPress version: 5.8.1
  • First release: Sep 8, 2018
  • Latest release: Oct 25, 2021
  • Number of updates: 37
  • Update frequency: every 30.9 days
  • Top authors: wooelements (100%)

Code review

53 tests

User reviews

15 reviews

Install metrics

8,000+ active / 37,179 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼280.76ms] Passed 4 tests

An overview of server-side resources used by Conditional Payments for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.1241.79 ▲17.08
Dashboard /wp-admin3.07 ▲0.0149.99 ▼0.99
Posts /wp-admin/edit.php3.12 ▲0.0150.51 ▲15.40
Add New Post /wp-admin/post-new.php5.43 ▲0.0092.84 ▼1,118.03
Media Library /wp-admin/upload.php3.01 ▲0.0031.27 ▼19.41

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 18 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Conditional Payments for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,674 ▲6816.29 ▲0.888.76 ▼1.1455.79 ▼0.89
Dashboard /wp-admin2,928 ▲785.88 ▲0.05178.42 ▲22.34129.11 ▲7.77
Posts /wp-admin/edit.php2,706 ▼02.69 ▼0.0080.91 ▲12.09115.08 ▲23.24
Add New Post /wp-admin/post-new.php1,479 ▼17717.10 ▼1.36356.82 ▼29.53110.00 ▼13.12
Media Library /wp-admin/upload.php1,772 ▼05.02 ▼0.00149.02 ▼2.46126.17 ▼5.58

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The plugin uninstalled successfully, without leaving any zombie files or tables

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 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/conditional-payments-for-woocommerce/includes/class-woo-conditional-payments-updater.php:127

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)
Everything seems fine, but this is not an exhaustive test

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
Please fix the following attributes: The official readme.txt might help

conditional-payments-for-woocommerce/conditional-payments-for-woocommerce.php 85% from 13 tests

The primary PHP file in "Conditional Payments for WooCommerce" version 2.2.4 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Requires at least: The required version number must match the one declared in readme.txt ("4.5" instead of "3.0.0")

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
There were no executable files found in this plugin2,297 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP103863561,754
CSS1636290
JavaScript28174253

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity27.14
▷ Minimum class complexity1.00
▷ Maximum class complexity65.00
Average method complexity3.47
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods71
▷ Static methods3447.89%
▷ Public methods6490.14%
▷ Protected methods00.00%
▷ Private methods79.86%
Functions31
▷ Named functions2787.10%
▷ Anonymous functions412.90%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 1 test

Image compression Passed 1 test

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.15MB with 0.06MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/banner-772x250.png44.29KB20.40KB▼ 53.95%
assets/icon-128x128.png2.75KB2.32KB▼ 15.53%
assets/screenshot-1.png103.79KB40.73KB▼ 60.76%