77% buy-one-get-one-free

Code Review | Buy one Get one Free - Other similar BOGO WooCommerce discount rule maker

WordPress plugin Buy one Get one Free - Other similar BOGO WooCommerce discount rule maker scored77%from 54 tests.

About plugin

  • Plugin page: buy-one-get-one-free
  • Plugin version: 1.10.32
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.4.0
  • WordPress version: 6.3.1
  • First release: Sep 8, 2019
  • Latest release: Nov 25, 2023
  • Number of updates: 198
  • Update frequency: every 7.8 days
  • Top authors: rajeshsingh520 (100%)

Code review

54 tests

User reviews

19 reviews

Install metrics

800+ active /63,037 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
Installer ran successfully

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

This is a short check of server-side resources used by Buy one Get one Free - Other similar BOGO WooCommerce discount rule maker
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0236.36 ▼7.17
Dashboard /wp-admin3.32 ▼0.0352.04 ▼9.38
Posts /wp-admin/edit.php3.37 ▲0.0147.37 ▲2.62
Add New Post /wp-admin/post-new.php5.90 ▲0.0181.43 ▼3.97
Media Library /wp-admin/upload.php3.24 ▲0.0133.60 ▲0.88

Server storage [IO: ▲1.67MB] [DB: ▲0.07MB] Passed 3 tests

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

Browser metrics Passed 4 tests

Buy one Get one Free - Other similar BOGO WooCommerce discount rule maker: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,821 ▲7014.13 ▼0.212.07 ▲0.3739.44 ▼4.84
Dashboard /wp-admin2,204 ▲235.55 ▼0.1296.48 ▼17.4143.55 ▼1.74
Posts /wp-admin/edit.php2,107 ▲72.03 ▲0.0940.06 ▲6.7238.04 ▲2.89
Add New Post /wp-admin/post-new.php1,532 ▼223.04 ▲0.04604.45 ▼5.2351.31 ▼3.13
Media Library /wp-admin/upload.php1,400 ▼04.14 ▼0.03100.86 ▲0.9142.67 ▼1.11

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts

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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/buy-one-get-one-free/admin/partials/explain.php
    • > /wp-content/plugins/buy-one-get-one-free/includes/pisol.class.form.php
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/buy-one-get-one-free/public/class-woo.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/buy-one-get-one-free/admin/class-buy-one-get-one-free-woocommerce-category.php:207
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/buy-one-get-one-free/admin/class-buy-one-get-one-free-woocommerce-option.php:133
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/buy-one-get-one-free/admin/class-buy-one-get-one-free-woocommerce-product.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/buy-one-get-one-free/includes/includes.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/buy-one-get-one-free/includes/banner-sample.php:63
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/buy-one-get-one-free/admin/class-buy-one-get-one-free-woocommerce-cat-message.php:103

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add descriptions for these screenshots #1, #10, #11, #12, #13, #14, #15, #2, #3, #4, #6, #7, #9 in buy-one-get-one-free/assets to your readme.txt
The official readme.txt is a good inspiration

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

The main file in "Buy one Get one Free - Other similar BOGO WooCommerce discount rule maker" v. 1.10.32 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("buy-one-get-one-free.php" instead of "buy-one-get-one-free-woocommerce.php")

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
No dangerous file extensions were detected14,538 lines of code in 38 files:
LanguageFilesBlank linesComment linesLines of code
CSS32,057209,451
SVG6553,232
PHP264864991,754
JavaScript32233101

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity10.50
▷ Minimum class complexity1.00
▷ Maximum class complexity54.00
Average method complexity2.51
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes20
▷ Abstract classes00.00%
▷ Concrete classes20100.00%
▷ Final classes00.00%
Methods126
▷ Static methods2217.46%
▷ Public methods12196.03%
▷ Protected methods00.00%
▷ Private methods53.97%
Functions10
▷ Named functions770.00%
▷ Anonymous functions330.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
7 PNG files occupy 0.94MB with 0.57MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/background.png74.27KB26.29KB▼ 64.60%
admin/img/close.png4.32KB3.39KB▼ 21.57%
admin/img/single-product.png236.96KB64.81KB▼ 72.65%
admin/img/product-variation.png291.95KB76.81KB▼ 73.69%
admin/img/product-page.png282.15KB75.31KB▼ 73.31%