78% yith-woocommerce-gift-cards

Code Review | YITH WooCommerce Gift Cards

WordPress plugin YITH WooCommerce Gift Cards scored 78% from 54 tests.

About plugin

  • Plugin page: yith-woocommerce-...
  • Plugin version: 2.8.0
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2-5.9
  • WordPress version: 5.9.2
  • First release: Sep 22, 2015
  • Latest release: Mar 31, 2022
  • Number of updates: 109
  • Update frequency: every 21.9 days
  • Top authors: yithemes (100%)

Code review

54 tests

User reviews

46 reviews

Install metrics

10,000+ active / 260,668 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.52MB] [CPU: ▼290.69ms] Passed 4 tests

Server-side resources used by YITH WooCommerce Gift Cards
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.08 ▲0.5768.60 ▼5.49
Dashboard /wp-admin3.91 ▲0.5146.76 ▲10.25
Posts /wp-admin/edit.php4.20 ▲0.5547.64 ▼8.84
Add New Post /wp-admin/post-new.php7.44 ▲0.47109.53 ▼1,156.87
Media Library /wp-admin/upload.php3.85 ▲0.5639.24 ▲8.46

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 280 new files
Database: no new tables, 1 new option
New WordPress options
yit_recently_activated

Browser metrics Passed 4 tests

Checking browser requirements for YITH WooCommerce Gift Cards
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,821 ▲6716.03 ▲0.558.54 ▼8.933.92 ▲0.22
Dashboard /wp-admin2,924 ▲456.43 ▲0.00190.77 ▼31.60200.45 ▼31.11
Posts /wp-admin/edit.php2,695 ▲103.44 ▲0.0283.44 ▼2.11186.88 ▲8.54
Add New Post /wp-admin/post-new.php1,641 ▼4918.95 ▼1.84669.25 ▼0.19200.21 ▼21.98
Media Library /wp-admin/upload.php1,705 ▲135.69 ▼0.04188.59 ▲3.86238.83 ▼13.91

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 1 option in the database
    • yit_recently_activated

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/yith-woocommerce-gift-cards/templates/status.php
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/yith-woocommerce-gift-cards/templates/status.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/yith-woocommerce-gift-cards/templates/admin/premium.php:183
    • > PHP Notice
      Undefined variable: sections in wp-content/plugins/yith-woocommerce-gift-cards/templates/status.php on line 11

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)
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
5 plugin tags: woocommerce, gift, certificate, gift certificate, gift card

yith-woocommerce-gift-cards/init.php 77% from 13 tests

"YITH WooCommerce Gift Cards" version 2.8.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("yith-woocommerce-gift-cards.php" instead of "init.php")
  • Description: The description should be shorter than 140 characters (currently 348 characters long)
  • Requires at least: The required version number must match the one declared in readme.txt ("5.7" instead of "6.2")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin36,110 lines of code in 233 files:
LanguageFilesBlank linesComment linesLines of code
PHP1583,8537,15517,050
JavaScript501,3638729,150
CSS171,4992367,526
PO File48471,0412,326
XML111935
SVG30123

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity43.26
▷ Minimum class complexity1.00
▷ Maximum class complexity258.00
Average method complexity3.94
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes38
▷ Abstract classes12.63%
▷ Concrete classes3797.37%
▷ Final classes00.00%
Methods548
▷ Static methods5710.40%
▷ Public methods48287.96%
▷ Protected methods448.03%
▷ Private methods224.01%
Functions134
▷ Named functions13097.01%
▷ Anonymous functions42.99%
Constants82
▷ Global constants3441.46%
▷ Class constants4858.54%
▷ Public constants48100.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
32 PNG files occupy 0.06MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
plugin-fw/assets/css/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png0.07KB0.08KB0.00%
plugin-fw/assets/images/sidebar-right.png0.95KB0.11KB▼ 87.91%
assets/images/choose-template-design.png0.36KB0.35KB▼ 4.58%
plugin-fw/assets/css/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png0.09KB0.14KB0.00%
plugin-fw/assets/css/jquery-ui/images/ui-icons_222222_256x240.png3.69KB4.18KB0.00%