78% bargain

Code Review | Bargain Bot for WooCommerce

WordPress plugin Bargain Bot for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: bargain
  • Plugin version: 1.5.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.4
  • WordPress version: 6.3.1
  • First release: Oct 6, 2019
  • Latest release: Nov 24, 2023
  • Number of updates: 50
  • Update frequency: every 30.2 days
  • Top authors: quantumcloud (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

60+ active /5,382 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.13MB] [CPU: ▼7.94ms] Passed 4 tests

A check of server-side resources used by Bargain Bot for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0123.56 ▼20.31
Dashboard /wp-admin3.48 ▲0.1746.32 ▼0.87
Posts /wp-admin/edit.php3.59 ▲0.2347.49 ▼0.75
Add New Post /wp-admin/post-new.php6.06 ▲0.1791.88 ▼9.84
Media Library /wp-admin/upload.php3.40 ▲0.1733.19 ▼0.67
Bargain Bot /wp-admin/admin.php?page=wbpt-minimum-acceptable-price-page3.3734.18
WoowBot /wp-admin/admin.php?page=wbpt-map-woowbot-supports3.71464.58
Support /wp-admin/admin.php?page=wbpt-minimum-acceptable-price-supports3.3732.93

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 130 new files
Database: no new tables, 30 new options
New WordPress options
theysaidso_admin_options
db_upgraded
qcld_minimum_accept_modal_submit_button_text
qcld_minimum_accept_modal_or_button_text
qcld_minimum_accept_price_talk_to_boss
qcld_minimum_accept_price_button_text
qcld_minimum_accept_price_acceptable_price
qcld_minimum_accept_price_get_email_address
qcld_minimum_accept_price_too_low_alert_text
qcld_minimum_accept_price_low_alert_text_two
...

Browser metrics Passed 4 tests

A check of browser resources used by Bargain Bot for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,489 ▼27314.13 ▼0.210.42 ▼1.357.78 ▼35.69
Dashboard /wp-admin2,230 ▲535.59 ▼0.0792.15 ▲2.1444.08 ▲3.76
Posts /wp-admin/edit.php2,135 ▲322.01 ▲0.0639.64 ▼3.6532.85 ▼4.49
Add New Post /wp-admin/post-new.php1,555 ▲2923.29 ▼0.05645.43 ▼9.2271.49 ▲14.12
Media Library /wp-admin/upload.php1,429 ▲294.20 ▼0.0199.01 ▼3.8544.87 ▲2.56
Bargain Bot /wp-admin/admin.php?page=wbpt-minimum-acceptable-price-page1,6182.1545.0353.66
WoowBot /wp-admin/admin.php?page=wbpt-map-woowbot-supports3,4803.3358.9372.21
Support /wp-admin/admin.php?page=wbpt-minimum-acceptable-price-supports1,5441.7927.7557.81

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
  • This plugin did not uninstall successfully, leaving 30 options in the database
    • qlcd_map_chatbot_admin_email_subject
    • widget_theysaidso_widget
    • qcld_minimum_accept_modal_yes_button_text
    • db_upgraded
    • qcld_minimum_accept_modal_submit_button_text
    • qcld_minimum_accept_price_too_low_alert_text
    • qlcd_map_chatbot_admin_email
    • qcld_minimum_accept_price_negotiating_test
    • can_compress_scripts
    • qcld_minimum_accept_price_heading_text
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however 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
Almost there! Just fix the following items
  • 4× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/bargain/wpbot-minimum-acceptable-price-addon.php
    • > /wp-content/plugins/bargain/wpbot-minimum-acceptable-price-function.php
    • > /wp-content/plugins/bargain/wpbot-minimum-acceptable-price-variation.php
    • > /wp-content/plugins/bargain/wpbot-minimum-acceptable-price-assets.php
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/bargain/class-qcld-free-plugin-upgrade-notice.php:34
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/bargain/qc-support-promo-page/class-qc-support-promo-page.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
5 plugin tags: name your price, dynamic pricing, woocommerce, deals, woocommerce dynamic pricing

bargain/wpbot-minimum-acceptable-price-addon.php 85% from 13 tests

The main PHP file in "Bargain Bot for WooCommerce" ver. 1.5.2 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: The principal plugin file should be the same as the plugin slug ("bargain.php" instead of "wpbot-minimum-acceptable-price-addon.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected23,714 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
CSS982410816,294
SVG3002,689
PHP98502412,337
JavaScript76752021,896
PO File1198232498

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity27.00
▷ Minimum class complexity14.00
▷ Maximum class complexity45.00
Average method complexity3.89
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods27
▷ Static methods00.00%
▷ Public methods27100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions29
▷ Named functions29100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
57 PNG files occupy 1.55MB with 0.92MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
qc-support-promo-page/images/logo (1).png9.74KB5.02KB▼ 48.48%
qc-support-promo-page/images/comment-link-remove.png33.90KB12.09KB▼ 64.34%
qc-support-promo-page/images/seo-suggest-1.png13.77KB6.86KB▼ 50.19%
qc-support-promo-page/images/highlight.png16.86KB6.57KB▼ 61.02%
qc-support-promo-page/images/premium-theme-chatbot-master.png50.54KB14.02KB▼ 72.27%