73% better-category-selector-for-woocommerce

Code Review | Better Category Selector for WooCommerce

WordPress plugin Better Category Selector for WooCommerce scored73%from 54 tests.

About plugin

  • Plugin page: better-category-s...
  • Plugin version: 1.0.5
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.9-6.4.1
  • WordPress version: 6.3.1
  • First release: Feb 18, 2022
  • Latest release: Nov 30, 2023
  • Number of updates: 25
  • Update frequency: every 26.1 days
  • Top authors: sgumby (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /746 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.06MB] [CPU: ▼4.39ms] Passed 4 tests

Analyzing server-side resources used by Better Category Selector for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0540.31 ▲0.36
Dashboard /wp-admin3.39 ▲0.0446.94 ▼12.55
Posts /wp-admin/edit.php3.50 ▲0.1448.05 ▲0.08
Add New Post /wp-admin/post-new.php5.97 ▲0.0891.50 ▼5.46
Media Library /wp-admin/upload.php3.31 ▲0.0836.46 ▲4.24
/wp-admin/admin.php?page=bcs-category-selector3.2930.91

Server storage [IO: ▲0.08MB] [DB: ▲0.07MB] Passed 3 tests

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
HD_BCS_db_version
can_compress_scripts
db_upgraded
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Better Category Selector for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.74 ▲0.401.81 ▼0.0144.89 ▲2.46
Dashboard /wp-admin2,195 ▲185.56 ▼0.1186.12 ▼13.2638.08 ▼4.49
Posts /wp-admin/edit.php2,100 ▼01.97 ▲0.0036.81 ▼6.1338.06 ▲4.03
Add New Post /wp-admin/post-new.php1,526 ▼023.47 ▲0.21635.48 ▲50.0149.22 ▼3.30
Media Library /wp-admin/upload.php1,400 ▼04.18 ▼0.0096.62 ▲2.0140.27 ▼0.41
/wp-admin/admin.php?page=bcs-category-selector7382.0227.389.03

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • HD_BCS_db_version
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-content/plugins/better-category-selector-for-woocommerce/bcs-category-selector.php+61
    Trying to get property 'labels' of non-object
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-content/plugins/better-category-selector-for-woocommerce/bcs-category-selector.php+60
    Trying to get property 'all_items' of non-object
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-content/plugins/better-category-selector-for-woocommerce/bcs-category-selector.php+61
    Trying to get property 'most_used' of non-object
  • 21 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-content/plugins/better-category-selector-for-woocommerce/includes/bcs-walker.class.php+111
    Trying to get property 'term_id' of non-object
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-admin/includes/template.php+118
    Trying to get property 'cap' of non-object
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-admin/includes/template.php+118
    Trying to get property 'assign_terms' of non-object
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-content/plugins/better-category-selector-for-woocommerce/includes/bcs-walker.class.php+115
    Trying to get property 'name' of non-object
    • > GET request to /wp-admin/admin.php?page=bcs-category-selector
    • > Notice in wp-content/plugins/better-category-selector-for-woocommerce/bcs-category-selector.php+84
    Trying to get property 'ID' of non-object

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/better-category-selector-for-woocommerce/better-category-selector-for-woocommerce.php
    • > /wp-content/plugins/better-category-selector-for-woocommerce/includes/bcs-loader.class.php
    • > /wp-content/plugins/better-category-selector-for-woocommerce/bcs-category-selector.php
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'Walker' not found in wp-content/plugins/better-category-selector-for-woocommerce/includes/bcs-walker.class.php:20

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed: You can take inspiration from this readme.txt

better-category-selector-for-woocommerce/better-category-selector-for-woocommerce.php Passed 13 tests

The primary PHP file in "Better Category Selector for WooCommerce" version 1.0.5 is used by WordPress to initiate all plugin functionality
119 characters long description:
Better Category Selector for WooCommerce provides an alternative, easier to use GUI for putting products in categories.

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
Success! There were no dangerous files found in this plugin878 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP7168470615
JavaScript13355190
CSS1171373

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity11.00
▷ Minimum class complexity4.00
▷ Maximum class complexity25.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods30
▷ Static methods1550.00%
▷ Public methods2480.00%
▷ Protected methods00.00%
▷ Private methods620.00%
Functions11
▷ Named functions11100.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants990.00%
▷ Class constants110.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/nobrainer_logo_220209.png12.88KB6.20KB▼ 51.88%