77% free-gifts-product-for-woocommerce

Code Review | Free Gift Product For Woocommerce

WordPress plugin Free Gift Product For Woocommerce scored77%from 54 tests.

About plugin

  • Plugin page: free-gifts-produc...
  • Plugin version: 1.0
  • PHP compatiblity: 5.0+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jun 4, 2022
  • Latest release: Sep 26, 2023
  • Number of updates: 10
  • Update frequency: every 48.0 days
  • Top authors: silverplugins217 (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

200+ active /2,528 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.00MB] [CPU: ▼7.16ms] Passed 4 tests

A check of server-side resources used by Free Gift Product For Woocommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0042.73 ▼4.59
Dashboard /wp-admin3.31 ▲0.0045.22 ▼7.26
Posts /wp-admin/edit.php3.36 ▲0.0048.86 ▼1.96
Add New Post /wp-admin/post-new.php5.89 ▲0.0082.79 ▼14.82
Media Library /wp-admin/upload.php3.23 ▲0.0036.15 ▲2.85

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 20 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

Free Gift Product For Woocommerce: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,846 ▲10013.43 ▼0.931.94 ▲0.1141.86 ▼0.41
Dashboard /wp-admin2,203 ▲185.83 ▼0.0798.66 ▼16.0338.70 ▼4.16
Posts /wp-admin/edit.php2,089 ▼02.00 ▼0.0239.59 ▲2.9534.81 ▲0.55
Add New Post /wp-admin/post-new.php1,542 ▲918.20 ▼4.97625.71 ▼47.4754.53 ▼8.16
Media Library /wp-admin/upload.php1,391 ▲34.27 ▲0.0996.56 ▼14.3841.33 ▼2.74

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
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

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

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
Please fix the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/free-gifts-product-for-woocommerce/free-gifts-woocommerce.php
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/free-gifts-product-for-woocommerce/main/resources/free-gifts-installation-require.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/free-gifts-product-for-woocommerce/main/resources/free-gifts-load-js-css.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/free-gifts-product-for-woocommerce/main/resources/free-gifts-language.php:4

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 86% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Contributors: Plugin contributors field is missing
The official readme.txt is a good inspiration

free-gifts-product-for-woocommerce/free-gifts-woocommerce.php 77% from 13 tests

"Free Gift Product For Woocommerce" version 1.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Domain Path: The domain path points to a folder that does not exist ("/languages")
  • Main file name: The principal plugin file should be the same as the plugin slug ("free-gifts-product-for-woocommerce.php" instead of "free-gifts-woocommerce.php")

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
Good job! No executable or dangerous file extensions detected4,467 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript46261,1542,675
PHP9172681,496
CSS4816296

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions35
▷ Named functions35100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/js/owlcarousel/assets/owl.video.play.png4.86KB2.74KB▼ 43.61%