88% buy-x-get-y-free-by-storepro

Code Review | Buy X Get Y Free by StorePro

WordPress plugin Buy X Get Y Free by StorePro scored 88% from 54 tests.

About plugin

  • Plugin page: buy-x-get-y-free-...
  • Plugin version: 1.0.5
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.8.1
  • WordPress version: 5.8.1
  • First release: Aug 18, 2020
  • Latest release: Oct 27, 2021
  • Number of updates: 18
  • Update frequency: every 24.2 days
  • Top authors: storepro (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

100+ active / 2,295 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

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

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

An overview of server-side resources used by Buy X Get Y Free by StorePro
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.0043.58 ▲8.61
Dashboard /wp-admin3.06 ▲0.0049.18 ▲3.27
Posts /wp-admin/edit.php3.11 ▲0.0045.90 ▲0.42
Add New Post /wp-admin/post-new.php5.42 ▼0.0288.28 ▼581.23
Media Library /wp-admin/upload.php3.00 ▲0.0035.22 ▲0.16

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 17 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Buy X Get Y Free by StorePro
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,703 ▲10716.26 ▲0.6411.74 ▲2.3047.50 ▼3.74
Dashboard /wp-admin2,967 ▲335.89 ▼0.08139.83 ▼8.80117.25 ▼5.44
Posts /wp-admin/edit.php2,736 ▼32.69 ▼0.0165.44 ▼6.7298.13 ▼1.57
Add New Post /wp-admin/post-new.php1,604 ▼7918.98 ▲0.39391.92 ▼4.07118.52 ▲3.60
Media Library /wp-admin/upload.php1,807 ▼05.01 ▲0.01155.68 ▼7.34119.57 ▼4.46

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Uninstall script ran successfully

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 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/buy-x-get-y-free-by-storepro/Inc/bogo_by_sp_class_forms.php
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/buy-x-get-y-free-by-storepro/public/bogo_by_sp_class_cart.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/buy-x-get-y-free-by-storepro/Inc/includes.php:2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/buy-x-get-y-free-by-storepro/admin/bogo_by_sp_class_admin_option.php:115

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Screenshots: Please add images for these screenshots: #7 (Select the Quantity of Free Product), #8 (Save settings), #9 (How that would look to customer)
You can take inspiration from this readme.txt

buy-x-get-y-free-by-storepro/bogo_by_sp.php 92% from 13 tests

Analyzing the main PHP file in "Buy X Get Y Free by StorePro" version 1.0.5
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("buy-x-get-y-free-by-storepro.php" instead of "bogo_by_sp.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin604 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP12214138535
JavaScript116167
CSS2052

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity9.33
▷ Minimum class complexity1.00
▷ Maximum class complexity31.00
Average method complexity2.70
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods44
▷ Static methods920.45%
▷ Public methods4193.18%
▷ Protected methods00.00%
▷ Private methods36.82%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/img/Sp_bogo.png1.62KB1.86KB0.00%