89% conditional-payments

Code Review | Conditional Payment Methods for WooCommerce

WordPress plugin Conditional Payment Methods for WooCommerce scored89%from 54 tests.

About plugin

  • Plugin page: conditional-payments
  • Plugin version: 1.1.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-6.4
  • WordPress version: 6.3.1
  • First release: Apr 5, 2022
  • Latest release: Nov 8, 2023
  • Number of updates: 20
  • Update frequency: every 29.8 days
  • Top authors: dots (100%)

Code review

54 tests

User reviews

1 review

Install metrics

400+ active /3,689 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

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

This is a short check of server-side resources used by Conditional Payment Methods for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0041.40 ▲5.31
Dashboard /wp-admin3.31 ▼0.0444.28 ▼13.10
Posts /wp-admin/edit.php3.36 ▲0.0045.58 ▼1.62
Add New Post /wp-admin/post-new.php5.90 ▲0.0080.42 ▼22.46
Media Library /wp-admin/upload.php3.24 ▲0.0035.18 ▲2.74

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 204 new files
Database: no new tables, 9 new options
New WordPress options
fs_active_plugins
widget_theysaidso_widget
can_compress_scripts
fs_debug_mode
widget_recent-posts
widget_recent-comments
fs_accounts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Conditional Payment Methods for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.20 ▼0.011.87 ▲0.2543.39 ▲1.55
Dashboard /wp-admin2,198 ▲205.62 ▼0.0988.97 ▼29.1441.92 ▼3.74
Posts /wp-admin/edit.php2,100 ▼32.01 ▲0.0539.18 ▲0.3737.31 ▲6.24
Add New Post /wp-admin/post-new.php1,526 ▼023.16 ▼0.41597.52 ▼30.9352.14 ▼10.64
Media Library /wp-admin/upload.php1,397 ▼64.18 ▼0.0198.04 ▲2.5141.30 ▼3.14

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin does not fully uninstall, leaving 9 options in the database
    • fs_debug_mode
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • fs_accounts
    • fs_active_plugins
    • widget_recent-comments

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Donate link: Invalid URI ("HTTP://example.com")
  • Screenshots: These screenshots lack descriptions #10, #11, #12, #2, #4, #6, #8, #9 in conditional-payments/assets to your readme.txt
You can take inspiration from this readme.txt

conditional-payments/conditional-payments.php 92% from 13 tests

The main PHP script in "Conditional Payment Methods for WooCommerce" version 1.1.4 is automatically included on every request by WordPress
You should first fix the following items:
  • Requires at least: Required version must match the one declared in readme.txt ("5.0" instead of "4.5")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin39,982 lines of code in 154 files:
LanguageFilesBlank linesComment linesLines of code
PHP1298,73818,65037,713
PO File45721,2041,333
JavaScript610691834
CSS1555102

PHP code 0% from 2 tests

An overview of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 3,096)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 167)
Cyclomatic complexity
Average complexity per logical line of code0.64
Average class complexity88.68
▷ Minimum class complexity1.00
▷ Maximum class complexity3,096.00
Average method complexity4.88
▷ Minimum method complexity1.00
▷ Maximum method complexity167.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes59
▷ Abstract classes23.39%
▷ Concrete classes5796.61%
▷ Final classes00.00%
Methods1,385
▷ Static methods21515.52%
▷ Public methods97670.47%
▷ Protected methods201.44%
▷ Private methods38928.09%
Functions107
▷ Named functions10699.07%
▷ Anonymous functions10.93%
Constants153
▷ Global constants10367.32%
▷ Class constants5032.68%
▷ Public constants50100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
admin/images/help.png1.27KB0.32KB▼ 74.79%