77% badge-management-for-woocommerce

Code Review | Badge Management for WooCommerce

WordPress plugin Badge Management for WooCommerce scored77%from 54 tests.

About plugin

  • Plugin page: badge-management-...
  • Plugin version: 2.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.0
  • WordPress version: 6.3.1
  • First release: Nov 26, 2015
  • Latest release: Jun 10, 2022
  • Number of updates: 108
  • Update frequency: every 22.1 days
  • Top authors: phoeniixx (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

300+ active /34,418 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.01MB] [CPU: ▼5.43ms] Passed 4 tests

Analyzing server-side resources used by Badge Management for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0137.34 ▼2.19
Dashboard /wp-admin3.32 ▲0.0146.96 ▼5.61
Posts /wp-admin/edit.php3.37 ▲0.0147.27 ▼7.58
Add New Post /wp-admin/post-new.php5.90 ▲0.0186.91 ▼6.33
Media Library /wp-admin/upload.php3.24 ▲0.0136.94 ▼0.86

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Badge Management for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,792 ▲3114.21 ▼0.181.71 ▲0.1748.17 ▲3.57
Dashboard /wp-admin2,201 ▲245.62 ▼0.0487.34 ▲1.9440.24 ▼0.85
Posts /wp-admin/edit.php2,103 ▲31.99 ▲0.0133.65 ▼5.8735.51 ▼4.29
Add New Post /wp-admin/post-new.php1,529 ▲122.99 ▼0.12676.89 ▼13.8750.00 ▼1.59
Media Library /wp-admin/upload.php1,400 ▼04.21 ▼0.03111.52 ▲0.3247.56 ▼0.17

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php
  • 16× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      Use of undefined constant PHBGPLUG_PATH - assumed 'PHBGPLUG_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 26
    • > PHP Warning
      Use of undefined constant PHBGPLUG_PATH - assumed 'PHBGPLUG_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 30
    • > PHP Warning
      Use of undefined constant PHBGPLUG_PATH - assumed 'PHBGPLUG_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 34
    • > PHP Warning
      Use of undefined constant PHBGPLUG_URL - assumed 'PHBGPLUG_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 110
    • > PHP Notice
      Undefined variable: active_class in wp-content/plugins/badge-management-for-woocommerce/admin/template/phoen_badge_management_template.php on line 12
    • > PHP Warning
      Use of undefined constant PHBGPLUG_PATH - assumed 'PHBGPLUG_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 28
    • > PHP Warning
      Use of undefined constant PHBGPLUG_URL - assumed 'PHBGPLUG_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 181
    • > PHP Warning
      Use of undefined constant PHBGPLUG_PATH - assumed 'PHBGPLUG_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_setting.php:14
    • > PHP Warning
      Use of undefined constant PHBGPLUG_URL - assumed 'PHBGPLUG_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/badge-management-for-woocommerce/admin/phoen_badge_management_premium.php on line 158

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 83% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that require attention:
  • Tags: Too many tags (27 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

badge-management-for-woocommerce/phoen_badge_management_plugin.php 69% from 13 tests

The principal PHP file in "Badge Management for WooCommerce" v. 2.0.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 165 characters long)
  • Domain Path: The domain path is invalid: folder "/languages/" does not exist
  • Text Domain: The text domain should only use lowercase characters and dashes
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("badge-management-for-woocommerce.php" instead of "phoen_badge_management_plugin.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
Everything looks great! No dangerous files found in this plugin1,356 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP642029768
JavaScript225162361
CSS34225227

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity28.00
▷ Minimum class complexity25.00
▷ Maximum class complexity31.00
Average method complexity2.59
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods34
▷ Static methods00.00%
▷ Public methods1852.94%
▷ Protected methods00.00%
▷ Private methods1647.06%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
18 PNG files occupy 0.30MB with 0.13MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/phoenixx.png0.52KB0.57KB0.00%
images/add_particular_badge.png60.05KB22.80KB▼ 62.04%
images/2.png1.87KB0.46KB▼ 75.42%
images/1.png1.49KB0.38KB▼ 74.20%
images/image-frame-even.png0.67KB0.62KB▼ 8.42%