78% d-bargain

Code Review | DBargain

WordPress plugin DBargain scored78%from 54 tests.

About plugin

  • Plugin page: d-bargain
  • Plugin version: 4.0.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Oct 6, 2022
  • Latest release: Oct 3, 2023
  • Number of updates: 21
  • Update frequency: every 17.6 days
  • Top authors: dbargain (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /465 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.19MB] [CPU: ▼9.27ms] 75% from 4 tests

Analyzing server-side resources used by DBargain
It is recommended to improve the following
  • CPU: Total CPU usage should be kept under 500.00ms (currently 729.77ms on /wp-admin/admin.php?page=dbargain)
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1936.69 ▼6.59
Dashboard /wp-admin3.49 ▲0.1948.21 ▼4.27
Posts /wp-admin/edit.php3.60 ▲0.2550.55 ▲4.90
Add New Post /wp-admin/post-new.php6.09 ▲0.2085.15 ▼17.50
Media Library /wp-admin/upload.php3.41 ▲0.1836.22 ▼8.73
All Offers /wp-admin/admin.php?page=dbargain3.38729.77
Session Chat History /wp-admin/admin.php?page=chat3.3831.19
Settings /wp-admin/admin.php?page=dbargain_settings3.38465.84

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for DBargain
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,961 ▲22613.92 ▼0.385.47 ▲3.5137.84 ▼9.02
Dashboard /wp-admin2,261 ▲705.28 ▲0.39111.12 ▼5.2042.22 ▼11.43
Posts /wp-admin/edit.php2,146 ▲602.43 ▲0.3942.62 ▲8.7434.75 ▲0.25
Add New Post /wp-admin/post-new.php1,557 ▲2923.54 ▲5.17683.14 ▲45.6936.88 ▼20.70
Media Library /wp-admin/upload.php1,446 ▲554.52 ▲0.3198.41 ▲2.5942.89 ▲2.10
All Offers /wp-admin/admin.php?page=dbargain8442.1127.6024.25
Session Chat History /wp-admin/admin.php?page=chat7081.147.3021.45
Settings /wp-admin/admin.php?page=dbargain_settings8442.0928.9725.01

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
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • recovery_mode_email_last_sent
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These server-side errors were triggered
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dbargain_settings
    • > Warning in wp-content/plugins/d-bargain/templates/expire.php+4
    session_start(): Cannot start session when headers already sent
    • > GET request to /wp-admin/admin.php?page=chat
    • > Notice in wp-content/plugins/d-bargain/templates/chat.php+15
    Undefined variable: sid
    • > GET request to /wp-admin/admin.php?page=chat
    • > Notice in wp-content/plugins/d-bargain/templates/chat.php+15
    Undefined variable: pid
    • > GET request to /wp-admin/admin.php?page=chat
    • > Error in wp-content/plugins/d-bargain/templates/chat.php+25
    Uncaught Error: Call to undefined function wc_get_product() in wp-content/plugins/d-bargain/templates/chat.php:25
    Stack trace:
    #0 wp-content/plugins/d-bargain/include/class-dbargain.php(562): require_once()
    #1 wp-includes/class-wp-hook.php(310): DBargain::chat()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown

SRP 50% 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
Please fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/d-bargain/include/class-dbargain.php:168

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)
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
6 plugin tags: bargaining plugin wordpress, bargaining tool, bargain, tool to boost sales, d-bargain...

d-bargain/d-bargain.php 85% from 13 tests

The entry point to "DBargain" version 4.0.1 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("5.4" instead of "4.2.0")
  • Text Domain: The text domain name should consist of only dashes and lowercase characters

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected1,802 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP83242211,651
JavaScript23110151

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity56.00
▷ Minimum class complexity4.00
▷ Maximum class complexity108.00
Average method complexity4.44
▷ Minimum method complexity1.00
▷ Maximum method complexity36.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods32
▷ Static methods2371.88%
▷ Public methods32100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
1 PNG file occupies 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
include/assets/cart_img.png16.25KB10.10KB▼ 37.87%