84% gift-pack-for-woocommerce

Code Review | Gift Pack for Woocommerce

WordPress plugin Gift Pack for Woocommerce scored84%from 54 tests.

About plugin

  • Plugin page: gift-pack-for-woo...
  • Plugin version: 1.1.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.4
  • WordPress version: 6.3.1
  • First release: Oct 17, 2022
  • Latest release: Dec 1, 2023
  • Number of updates: 22
  • Update frequency: every 18.7 days
  • Top authors: itpathsolutions (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active /2,601 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.21MB] [CPU: ▼3.80ms] Passed 4 tests

Analyzing server-side resources used by Gift Pack for Woocommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.70 ▲0.2444.93 ▲1.57
Dashboard /wp-admin3.52 ▲0.1750.67 ▼12.58
Posts /wp-admin/edit.php3.63 ▲0.2755.00 ▲5.11
Add New Post /wp-admin/post-new.php6.10 ▲0.2194.41 ▼9.31
Media Library /wp-admin/upload.php3.44 ▲0.2140.41 ▲8.07

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 33 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Gift Pack for Woocommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,900 ▲15313.36 ▼1.358.72 ▲7.0044.85 ▲0.39
Dashboard /wp-admin2,213 ▲395.59 ▲0.0190.56 ▲3.5641.09 ▲1.54
Posts /wp-admin/edit.php2,124 ▲242.00 ▲0.0740.78 ▲2.3637.50 ▲1.72
Add New Post /wp-admin/post-new.php1,544 ▲923.25 ▲4.86579.62 ▼68.3149.83 ▼15.69
Media Library /wp-admin/upload.php1,418 ▲154.13 ▼0.0695.32 ▼0.7843.31 ▲0.09

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
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 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
Please take a closer look at the following
  • 6× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Gift_Pack_For_Woocommerce' not found in wp-content/plugins/gift-pack-for-woocommerce/public/partials/gift-pack-for-woocommerce-public-display.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Gift_Pack_For_Woocommerce' not found in wp-content/plugins/gift-pack-for-woocommerce/admin/partials/gift-pack-html.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Gift_Pack_For_Woocommerce' not found in wp-content/plugins/gift-pack-for-woocommerce/admin/partials/gift-pack-for-woocommerce-public-display.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Gift_Pack_For_Woocommerce' not found in wp-content/plugins/gift-pack-for-woocommerce/public/partials/gift-pack-html.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Gift_Pack_For_Woocommerce' not found in wp-content/plugins/gift-pack-for-woocommerce/admin/partials/gift-pack-for-woocommerce-admin-display.php:14
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/gift-pack-for-woocommerce/public/partials/gift-pack-data-in-order.php:17

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 on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
6 plugin tags: gift wrapper, gift wrap, gift, gift pack, woocommmerce...

gift-pack-for-woocommerce/gift-pack-for-woocommerce.php Passed 13 tests

The main PHP script in "Gift Pack for Woocommerce" version 1.1.2 is automatically included on every request by WordPress
80 characters long description:
Allow customers add gift pack/wrapping to individual products from product pages

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin2,224 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP143265991,627
JavaScript46177356
CSS238241

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity22.00
▷ Minimum class complexity1.00
▷ Maximum class complexity102.00
Average method complexity4.42
▷ Minimum method complexity1.00
▷ Maximum method complexity97.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods43
▷ Static methods49.30%
▷ Public methods3888.37%
▷ Protected methods00.00%
▷ Private methods511.63%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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
5 PNG files occupy 0.15MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/images/yellow_gift_pack.png35.30KB13.31KB▼ 62.30%
public/images/default_gift.png2.69KB2.73KB0.00%
public/images/green_gift_pack.png37.52KB13.35KB▼ 64.41%
public/images/blue_gift_pack.png41.49KB15.11KB▼ 63.58%
public/images/pink_gift_pack.png37.24KB13.88KB▼ 62.72%