10% brands-for-woocommerce

Code Review | Brands for WooCommerce

WordPress plugin Brands for WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: brands-for-woocom...
  • Plugin version: 3.8.2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Aug 15, 2016
  • Latest release: Sep 22, 2023
  • Number of updates: 82
  • Update frequency: every 31.7 days
  • Top authors: RazyRx (64.63%)dholovnia (36.59%)

Code review

54 tests

User reviews

67 reviews

Install metrics

6,000+ active /97,361 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Please fix the following installer errors
  • This plugin did not install gracefully
    • > Error in wp-content/plugins/brands-for-woocommerce/main.php+318
    Uncaught Error: Call to undefined function woocommerce_get_page_id() in wp-content/plugins/brands-for-woocommerce/main.php:318
    Stack trace:
    #0 wp-content/plugins/brands-for-woocommerce/main.php(1262): BeRocket_product_brand->register_taxonomy()
    #1 wp-includes/class-wp-hook.php(310): BeRocket_product_brand->activation()
    #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/includes/plugin.php(693): do_action()

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

Server-side resources used by Brands for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0042.14 ▲1.90
Dashboard /wp-admin3.31 ▼0.0449.02 ▼18.10
Posts /wp-admin/edit.php3.36 ▲0.0052.16 ▼0.39
Add New Post /wp-admin/post-new.php5.89 ▲0.0096.07 ▲0.99
Media Library /wp-admin/upload.php3.23 ▲0.0033.64 ▼8.73

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 150 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
br-product_brand-options

Browser metrics Passed 4 tests

An overview of browser requirements for Brands for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,840 ▲5414.86 ▲0.472.13 ▲0.2745.13 ▲2.71
Dashboard /wp-admin2,221 ▲215.88 ▲0.0399.62 ▼2.3941.31 ▼1.17
Posts /wp-admin/edit.php2,103 ▼02.04 ▼0.0240.91 ▼3.7737.79 ▼0.62
Add New Post /wp-admin/post-new.php1,554 ▲918.36 ▼4.89603.99 ▼98.8648.83 ▲0.12
Media Library /wp-admin/upload.php1,403 ▲34.24 ▼0.04101.20 ▼10.3544.34 ▼2.77

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments

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
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
Please take a closer look at the following
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/brands-for-woocommerce/templates/description.php
    • > /wp-content/plugins/brands-for-woocommerce/templates/list.php
  • 66× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/brands-for-woocommerce/addons/divi_shortcode/divi_shortcode.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/brands-for-woocommerce/berocket/includes/admin_notices.php:797
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_Brand_Base_Widget' not found in wp-content/plugins/brands-for-woocommerce/includes/widgets/base-widget_base_product_list.php:2
    • > PHP Notice
      Undefined variable: ordered_terms in wp-content/plugins/brands-for-woocommerce/templates/list.php on line 74
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/brands-for-woocommerce/templates/catalog.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/brands-for-woocommerce/main.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/brands-for-woocommerce/includes/widgets/base-widget.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'ET_Builder_Module' not found in wp-content/plugins/brands-for-woocommerce/divi/includes/modules/product_brands_info/product_brands_info.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/brands-for-woocommerce/addons/divi_shortcode/divi-builder.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/brands-for-woocommerce/templates/permalink_option.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 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
Attributes that need to be fixed:
  • Tags: You are using too many tags: 24 tag instead of maximum 10
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (General settings), #2 (Adding brands)
You can take inspiration from this readme.txt

brands-for-woocommerce/woocommerce-brand.php 92% from 13 tests

Analyzing the main PHP file in "Brands for WooCommerce" version 3.8.2.3
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("brands-for-woocommerce.php" instead of "woocommerce-brand.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected29,302 lines of code in 107 files:
LanguageFilesBlank linesComment linesLines of code
PHP651,0081,48314,551
CSS172,65410010,150
PO File49461,0782,041
JavaScript1495862,029
JSX5305497
XML20034

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity30.41
▷ Minimum class complexity1.00
▷ Maximum class complexity240.00
Average method complexity4.20
▷ Minimum method complexity1.00
▷ Maximum method complexity98.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes59
▷ Abstract classes00.00%
▷ Concrete classes59100.00%
▷ Final classes00.00%
Methods538
▷ Static methods13925.84%
▷ Public methods49892.57%
▷ Protected methods213.90%
▷ Private methods193.53%
Functions46
▷ Named functions4189.13%
▷ Anonymous functions510.87%
Constants8
▷ Global constants8100.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
8 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
berocket/assets/css/mail.png2.59KB1.92KB▼ 26.02%
berocket/libraries/addons/default.png3.87KB2.63KB▼ 31.94%
berocket/includes/ico.png1.90KB1.41KB▼ 25.89%
images/ad_white_on_orange.png20.67KB15.57KB▼ 24.67%
berocket/libraries/templates/default.png3.87KB2.63KB▼ 31.94%