79% woocommerce-multiple-free-gift

Code Review | WooCommerce Multiple Free Gift

WordPress plugin WooCommerce Multiple Free Gift scored79%from 54 tests.

About plugin

  • Plugin page: woocommerce-multi...
  • Plugin version: 1.2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-5.0
  • WordPress version: 6.3.1
  • First release: Jul 3, 2015
  • Latest release: Mar 30, 2020
  • Number of updates: 50
  • Update frequency: every 34.6 days
  • Top authors: ankitpokhrel (100%)

Code review

54 tests

User reviews

42 reviews

Install metrics

4,000+ active /89,178 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.20MB] [CPU: ▼4.89ms] Passed 4 tests

This is a short check of server-side resources used by WooCommerce Multiple Free Gift
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1730.29 ▼7.34
Dashboard /wp-admin3.50 ▲0.2047.54 ▲1.04
Posts /wp-admin/edit.php3.62 ▲0.2644.50 ▼6.30
Add New Post /wp-admin/post-new.php6.10 ▲0.2287.34 ▼6.96
Media Library /wp-admin/upload.php3.43 ▲0.2035.37 ▲1.11
Woo Free Gift /wp-admin/admin.php?page=woocommerce-multiple-free-gift3.4133.19
General Settings /wp-admin/admin.php?page=woocommerce-multiple-free-gift-settings3.4134.03
Gift Criteria /wp-admin/admin.php?page=woocommerce-multiple-free-gift-criteria3.4131.03

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 30 new files
Database: no new tables, 12 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
_wfg_popup_add_gift_text
_wfg_popup_cancel_text
recovery_mode_email_last_sent
_wfg_popup_heading
widget_recent-comments
db_upgraded
_wfg_invalid_condition_text
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for WooCommerce Multiple Free Gift
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,605 ▼16613.92 ▼0.396.48 ▲4.7036.85 ▼4.86
Dashboard /wp-admin2,252 ▲645.23 ▼0.58104.90 ▲4.6837.66 ▼5.36
Posts /wp-admin/edit.php2,141 ▲492.20 ▲0.1837.31 ▼7.2532.36 ▼4.29
Add New Post /wp-admin/post-new.php1,553 ▲723.48 ▲5.45674.31 ▲85.2474.60 ▲20.54
Media Library /wp-admin/upload.php1,428 ▲404.55 ▲0.3899.46 ▼1.7643.40 ▼4.39
Woo Free Gift /wp-admin/admin.php?page=woocommerce-multiple-free-gift7541.789.8421.33
General Settings /wp-admin/admin.php?page=woocommerce-multiple-free-gift-settings9622.1727.8932.41
Gift Criteria /wp-admin/admin.php?page=woocommerce-multiple-free-gift-criteria9442.0731.3627.24

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • Zombie WordPress options were found after uninstall: 7 options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • recovery_mode_email_last_sent
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=woocommerce-multiple-free-gift
    • > Error in wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/pages/main_menu_page.php+116
    Uncaught Error: Call to undefined function woocommerce_get_page_id() in wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/pages/main_menu_page.php:116
    Stack trace:
    #0 wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/WFG_Admin.class.php(180): include()
    #1 wp-includes/class-wp-hook.php(310): WFG_Admin->main_menu_template()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/pages/gift_criteria.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WFG_Settings_Helper' not found in wp-content/plugins/woocommerce-multiple-free-gift/templates/default/template-default.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/pages/main_menu_page.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/pages/general_settings.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/WFG_Admin.class.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'WFG_Settings_Helper' not found in wp-content/plugins/woocommerce-multiple-free-gift/lib/WFG_Frontend.class.php:42
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woocommerce-multiple-free-gift/lib/admin/WFG_Single_Gift.class.php:22

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 issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
9 plugin tags: woocommerce multiple free gifts, woocommerce prizes, woocommerce plugin, woocommerce gift management, woocommerce multiple gifts...

woocommerce-multiple-free-gift/woocommerce-multiple-free-gift.php Passed 13 tests

The main file in "WooCommerce Multiple Free Gift" v. 1.2.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
31 characters long description:
WooCommerce giveaway made easy.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin2,466 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP142387101,417
CSS49840874
PO File133085
JavaScript3122484
SVG1016

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity20.38
▷ Minimum class complexity1.00
▷ Maximum class complexity54.00
Average method complexity3.35
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods66
▷ Static methods2943.94%
▷ Public methods5177.27%
▷ Protected methods57.58%
▷ Private methods1015.15%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants360.00%
▷ Class constants240.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/admin/img/default_cat.png18.80KB0.81KB▼ 95.69%
lib/admin/img/ddown.png0.18KB0.13KB▼ 29.89%
lib/admin/img/wfg-logo.png0.99KB0.63KB▼ 36.09%