93% gift-products-for-woocommerce

Code Review | Gift Products For Woocommerce

WordPress plugin Gift Products For Woocommerce scored 93% from 54 tests.

About plugin

  • Plugin page: gift-products-for...
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress version: 5.9.2
  • First release: Dec 17, 2019
  • Latest release: Apr 4, 2022
  • Number of updates: 29
  • Update frequency: every 28.9 days
  • Top authors: vp956009 (100%)

Code review

54 tests

User reviews

22 reviews

Install metrics

1,000+ active / 8,723 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

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

This is a short check of server-side resources used by Gift Products For Woocommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0165.10 ▼12.98
Dashboard /wp-admin3.41 ▲0.0034.11 ▼6.64
Posts /wp-admin/edit.php3.64 ▼0.0040.11 ▼13.26
Add New Post /wp-admin/post-new.php6.88 ▼0.09103.21 ▼1,214.55
Media Library /wp-admin/upload.php3.30 ▲0.0038.94 ▲4.49

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Gift Products For Woocommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,890 ▲14516.13 ▲0.647.77 ▼0.593.06 ▼0.83
Dashboard /wp-admin2,958 ▲396.46 ▲0.09191.87 ▼20.36195.06 ▼26.63
Posts /wp-admin/edit.php2,724 ▲63.44 ▲0.0188.35 ▼16.02168.43 ▼36.62
Add New Post /wp-admin/post-new.php1,662 ▲1917.10 ▼3.79660.68 ▲29.22197.98 ▼8.35
Media Library /wp-admin/upload.php1,730 ▼05.74 ▲0.04190.49 ▼5.65249.06 ▼0.95

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
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 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
The following issues need your attention
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/gift-products-for-woocommerce/woo-product-gift.php

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% 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:
  • Contributors: Plugin contributors not specified
  • Screenshots: Add descriptions for screenshots #1, #10, #11, #12, #13, #14, #2, #3, #4, #5, #6, #7, #8, #9 in gift-products-for-woocommerce/assets to your readme.txt
You can look at the official readme.txt

gift-products-for-woocommerce/woo-product-gift.php 85% from 13 tests

The main file in "Gift Products For Woocommerce" v. 1.0.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("gift-products-for-woocommerce.php" instead of "woo-product-gift.php")
  • Domain Path: The domain path is invalid: folder "/languages" does not exist

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
No dangerous file extensions were detected4,711 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript55891,1152,550
PHP3370321,535
CSS82663625
SVG1001

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity75.00
▷ Minimum class complexity5.00
▷ Maximum class complexity145.00
Average method complexity7.00
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods37
▷ Static methods410.81%
▷ Public methods37100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
8 PNG files occupy 0.07MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/images/plus-circular-button.png0.94KB0.69KB▼ 26.59%
includes/images/review.png15.87KB11.90KB▼ 25.01%
includes/images/support.png6.44KB5.59KB▼ 13.09%
includes/images/minus.png0.61KB0.37KB▼ 40.19%
includes/images/minus_1.png0.91KB0.67KB▼ 27.06%