10% woo-restrict-by-category

Code Review | WooCommerce Restrict By Category

WordPress plugin WooCommerce Restrict By Category scored10%from 54 tests.

About plugin

  • Plugin page: woo-restrict-by-c...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.8.1
  • WordPress version: 6.3.1
  • First release: Sep 19, 2017
  • Latest release: Sep 20, 2017
  • Number of updates: 6
  • Update frequency: every 0.3 days
  • Top authors: EDGARROJAS (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

10+ active /2,460 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/woo-restrict-by-category/woocommerce-restrict-by-category-config.php+18
    Constant WC_RESTRICT_BY_CATEGORY_URL already defined

Server metrics [RAM: ▼1.94MB] [CPU: ▼62.00ms] Passed 4 tests

An overview of server-side resources used by WooCommerce Restrict By Category
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.05 ▼1.414.72 ▼40.96
Dashboard /wp-admin2.07 ▼1.277.06 ▼58.00
Posts /wp-admin/edit.php2.07 ▼1.286.41 ▼51.23
Add New Post /wp-admin/post-new.php2.07 ▼3.816.27 ▼97.80
Media Library /wp-admin/upload.php2.07 ▼1.165.41 ▼32.54

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 53 new files
Database: 1 new table, 8 new options
New tables
wp_rednao_wcrbc_privileges
New WordPress options
WC_RESTRICT_BY_CATEGORY_DB_VERSION
widget_recent-comments
REDNAO_WCRBC_RESTRICTED_PRODUCT_PAGE_ID
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for WooCommerce Restrict By Category
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,809 ▲4814.23 ▼0.131.68 ▼0.6641.33 ▼3.23
Dashboard /wp-admin2,218 ▲415.59 ▼0.02100.57 ▲7.6480.68 ▲42.65
Posts /wp-admin/edit.php2,126 ▲261.99 ▼0.0337.82 ▼2.7834.75 ▼0.25
Add New Post /wp-admin/post-new.php1,567 ▲4118.36 ▼4.73659.10 ▲12.7381.69 ▲18.78
Media Library /wp-admin/upload.php1,420 ▲204.11 ▼0.16101.56 ▼5.0572.19 ▲27.83

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/woo-restrict-by-category/woocommerce-restrict-by-category-config.php+18
    Constant WC_RESTRICT_BY_CATEGORY_URL already defined
  • Zombie tables detected upon uninstall: 1 table
    • wp_rednao_wcrbc_privileges
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • REDNAO_WCRBC_RESTRICTED_PRODUCT_PAGE_ID
    • can_compress_scripts
    • WC_RESTRICT_BY_CATEGORY_DB_VERSION
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
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
The following issues need your attention
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/woo-restrict-by-category/woocommerce-restrict-by-category.php
    • > /wp-content/plugins/woo-restrict-by-category/woocommerce-restrict-by-category-config.php
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_terms() in wp-content/plugins/woo-restrict-by-category/screens/user_restriction.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_terms() in wp-content/plugins/woo-restrict-by-category/screens/roles_restriction.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-restrict-by-category/filter-manager.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-restrict-by-category/ajax.php:2

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 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Screenshots: Screenshot #3 (Playing a recorded user) image not found
The official readme.txt might help

woo-restrict-by-category/woocommerce-restrict-by-category.php 92% from 13 tests

"WooCommerce Restrict By Category" version 1.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("woo-restrict-by-category.php" instead of "woocommerce-restrict-by-category.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin7,035 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
SVG2002,959
CSS763232,781
JavaScript7112442
PHP78444423
TypeScript4474220
XML600193
JSON10017

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions17
▷ Named functions1694.12%
▷ Anonymous functions15.88%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG files were detected