87% accept-donations-with-custom-amount

Code Review | Accept Donations with custom amount

WordPress plugin Accept Donations with custom amount scored 87% from 54 tests.

About plugin

  • Plugin page: accept-donations-...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.9
  • WordPress version: 5.9.2
  • First release: Jun 2, 2021
  • Latest release: Feb 8, 2022
  • Number of updates: 4
  • Update frequency: every 62.8 days
  • Top authors: sgsoftwaresolutions (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 200 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▼0.02MB] [CPU: ▼300.78ms] Passed 4 tests

Server-side resources used by Accept Donations with custom amount
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0156.69 ▲1.69
Dashboard /wp-admin3.41 ▲0.0196.84 ▲61.24
Posts /wp-admin/edit.php3.65 ▲0.0135.58 ▼2.09
Add New Post /wp-admin/post-new.php6.89 ▼0.0899.96 ▼1,214.32
Media Library /wp-admin/upload.php3.30 ▲0.0137.25 ▲11.59

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 23 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Accept Donations with custom amount
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,769 ▲1415.67 ▼0.216.64 ▲0.242.28 ▼1.00
Dashboard /wp-admin2,901 ▲466.11 ▼0.03121.01 ▼30.40160.86 ▼26.48
Posts /wp-admin/edit.php2,694 ▲373.24 ▲0.0166.22 ▼0.03218.29 ▲76.18
Add New Post /wp-admin/post-new.php1,672 ▼4717.88 ▼4.13430.45 ▼7.98163.34 ▼2.39
Media Library /wp-admin/upload.php1,706 ▲115.53 ▲0.05140.60 ▼24.80189.20 ▼17.93

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstaller ran successfully

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/accept-donations-with-custom-amount/admin/partials/sg-donation-woocommerce-admin-display.php
    • > /wp-content/plugins/accept-donations-with-custom-amount/public/partials/sg-donation-woocommerce-public-display.php
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/accept-donations-with-custom-amount/includes/class-sg-donation-woocommerce-methods.php:3

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)
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Plugin Name: You should set the name of your plugin on the first line ( === accept-donations-with-custom-amount === )
The official readme.txt might help

accept-donations-with-custom-amount/sg-donation-woocommerce.php 77% from 13 tests

The primary PHP file in "Accept Donations with custom amount" version 1.0.0 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Description: The description should be shorter than 140 characters (currently 167 characters long)
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: The principal plugin file should be the same as the plugin slug ("accept-donations-with-custom-amount.php" instead of "sg-donation-woocommerce.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected256 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP13128543250
JavaScript24546
CSS2080

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.14
Average class complexity1.57
▷ Minimum class complexity1.00
▷ Maximum class complexity3.00
Average method complexity1.17
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods23
▷ Static methods28.70%
▷ Public methods1878.26%
▷ Protected methods00.00%
▷ Private methods521.74%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin