89% gift-upon-purchase-for-woocommerce

Code Review | Gift upon purchase for WooCommerce

WordPress plugin Gift upon purchase for WooCommerce scored89%from 54 tests.

About plugin

  • Plugin page: gift-upon-purchas...
  • Plugin version: 1.3.6
  • PHP compatiblity: 7.0.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-6.4.1
  • WordPress version: 6.3.1
  • First release: Apr 14, 2020
  • Latest release: Nov 15, 2023
  • Number of updates: 37
  • Update frequency: every 35.4 days
  • Top authors: icopydoc (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

300+ active /5,421 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

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

Analyzing server-side resources used by Gift upon purchase for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0238.97 ▼2.98
Dashboard /wp-admin3.32 ▲0.0248.90 ▼1.92
Posts /wp-admin/edit.php3.37 ▲0.0247.41 ▼1.23
Add New Post /wp-admin/post-new.php5.90 ▲0.0286.97 ▼18.28
Media Library /wp-admin/upload.php3.24 ▲0.0234.09 ▼3.98

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 29 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Gift upon purchase for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲3314.05 ▼0.261.99 ▲0.1233.30 ▼10.96
Dashboard /wp-admin2,200 ▲265.66 ▲0.1492.31 ▼4.4941.93 ▼5.71
Posts /wp-admin/edit.php2,105 ▲52.03 ▲0.0038.73 ▼0.8738.81 ▼2.95
Add New Post /wp-admin/post-new.php1,531 ▼422.98 ▼0.25655.06 ▼33.6249.80 ▼16.16
Media Library /wp-admin/upload.php1,402 ▲54.23 ▲0.05101.69 ▲3.7844.62 ▲2.91

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

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

SRP Passed 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
Congratulations! This plugin passed the SRP test

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Screenshots: Screenshot #1 (screenshot-1.png) image required
Please take inspiration from this readme.txt

gift-upon-purchase-for-woocommerce/gift-upon-purchase-for-woocommerce.php 92% from 13 tests

"Gift upon purchase for WooCommerce" version 1.3.6's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

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
Success! There were no dangerous files found in this plugin3,247 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
PHP142486592,616
PO File27541,692573
CSS10130
JavaScript12428

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity58.20
▷ Minimum class complexity10.00
▷ Maximum class complexity210.00
Average method complexity4.12
▷ Minimum method complexity1.00
▷ Maximum method complexity41.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes360.00%
Methods82
▷ Static methods56.10%
▷ Public methods5465.85%
▷ Protected methods44.88%
▷ Private methods2429.27%
Functions42
▷ Named functions3173.81%
▷ Anonymous functions1126.19%
Constants18
▷ Global constants1794.44%
▷ Class constants15.56%
▷ 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
1 PNG file occupies 0.08MB with 0.05MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png83.11KB30.97KB▼ 62.73%