62% buy-one-get-one-free-for-woocommerce

Code Review | Buy One Get One Free for WooCommerce

WordPress plugin Buy One Get One Free for WooCommerce scored62%from 54 tests.

About plugin

  • Plugin page: buy-one-get-one-f...
  • Plugin version: 1.0.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.1.1-6.1.1
  • WordPress version: 6.3.1
  • First release: Jan 6, 2023
  • Latest release: Jan 6, 2023
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: chrisvolte (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /220 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.41MB] [CPU: ▼46.99ms] Passed 4 tests

An overview of server-side resources used by Buy One Get One Free for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1218.65 ▼26.72
Dashboard /wp-admin3.61 ▲0.2622.14 ▼52.55
Posts /wp-admin/edit.php3.61 ▲0.2520.96 ▼32.05
Add New Post /wp-admin/post-new.php3.61 ▼2.2819.72 ▼76.62
Media Library /wp-admin/upload.php3.61 ▲0.3822.79 ▼13.22

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 579 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Buy One Get One Free for WooCommerce: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,754 ▲818.39 ▲3.950.58 ▼1.1719.56 ▼26.29
Dashboard /wp-admin2,507 ▲3229.25 ▲4.37166.74 ▲53.2843.71 ▼0.65
Posts /wp-admin/edit.php2,416 ▲3306.19 ▲4.2080.65 ▲45.6132.90 ▼4.00
Add New Post /wp-admin/post-new.php1,443 ▼9019.65 ▼3.80617.78 ▼107.1741.77 ▼17.07
Media Library /wp-admin/upload.php1,549 ▲1646.54 ▲2.35118.91 ▲14.6943.76 ▼5.16
Buy One Get One /wp-admin/crb_carbon_fields_container_buy_one_get_one.php260.440.0714.66

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-content/plugins/buy-one-get-one-free-for-woocommerce/includes/options-page.php+48
    Use of undefined constant SV_BOGO_PLUGIN_NAME - assumed 'SV_BOGO_PLUGIN_NAME' (this will throw an Error in a future version of PHP)
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/htmlburger/carbon-fields/templates/Exception/incorrect-syntax.php
  • 214× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Field\\Field' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/htmlburger/carbon-fields/core/Field/Media_Gallery_Field.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/DframeInstaller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\Comparer\\Comparer' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/htmlburger/carbon-fields/core/Container/Condition/Comparer/Any_Equality_Comparer.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/buy-one-get-one-free-for-woocommerce/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php:6

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
These are user-side errors you should fix
    • > GET request to /wp-admin/crb_carbon_fields_container_buy_one_get_one.php
    • > Network (severe)
    wp-admin/crb_carbon_fields_container_buy_one_get_one.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% 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
Please fix the following attributes:
  • Tags: Please reduce the number of tags, currently 17 tag instead of maximum 10
The official readme.txt is a good inspiration

buy-one-get-one-free-for-woocommerce/buy-one-get-one-free-for-woocommerce.php 92% from 13 tests

The main PHP file in "Buy One Get One Free for WooCommerce" ver. 1.0.0 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
No dangerous file extensions were detected30,509 lines of code in 522 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1745,2078,47513,002
PHP2522,8907,05010,941
PO File268191,0202,202
Sass4833901,769
CSS93261,1421,679
JSON600722
YAML3313123
Markdown426071

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity5.45
▷ Minimum class complexity1.00
▷ Maximum class complexity50.00
Average method complexity2.03
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces24
Interfaces5
Traits0
Classes225
▷ Abstract classes125.33%
▷ Concrete classes21394.67%
▷ Final classes10.47%
Methods1,003
▷ Static methods929.17%
▷ Public methods79078.76%
▷ Protected methods20220.14%
▷ Private methods111.10%
Functions119
▷ Named functions3226.89%
▷ Anonymous functions8773.11%
Constants38
▷ Global constants1128.95%
▷ Class constants2771.05%
▷ Public constants27100.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
No PNG files were detected