10% woo-require-categories-when-creating-products

Code Review | Require Categories when Creating Products - WooCommerce

WordPress plugin Require Categories when Creating Products - WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: woo-require-categ...
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.2
  • WordPress version: 6.3.1
  • First release: Aug 28, 2018
  • Latest release: May 1, 2019
  • Number of updates: 5
  • Update frequency: every 49.2 days
  • Top authors: JoseVega (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /690 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
  • The plugin did not install without errors
    • > Warning in wp-includes/class-wp-hook.php+310
    call_user_func_array() expects parameter 1 to be a valid callback, function 'enable_welcome_page' not found or invalid function name

Server metrics [RAM: ▼0.10MB] [CPU: ▼10.12ms] Passed 4 tests

This is a short check of server-side resources used by Require Categories when Creating Products - WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0136.15 ▼0.57
Dashboard /wp-admin3.33 ▲0.0246.03 ▼3.84
Posts /wp-admin/edit.php3.44 ▲0.0844.33 ▼6.38
Add New Post /wp-admin/post-new.php5.46 ▼0.4371.99 ▼29.67
Media Library /wp-admin/upload.php3.25 ▲0.0234.14 ▲0.17
Required Product Categories /wp-admin/admin.php?page=wprtt_whats_new3.1929.18
Required Product Categories /wp-admin/admin.php?page=wprtt_welcome_page3.3132.82

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Require Categories when Creating Products - WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6514.48 ▲0.051.76 ▲0.0744.02 ▲3.66
Dashboard /wp-admin2,206 ▲275.88 ▲0.00110.29 ▲2.1840.77 ▼5.11
Posts /wp-admin/edit.php2,092 ▼02.02 ▲0.0238.45 ▼6.3335.33 ▼1.54
Add New Post /wp-admin/post-new.php1,519 ▼2323.00 ▲4.67633.50 ▲30.9851.92 ▼7.60
Media Library /wp-admin/upload.php1,388 ▼34.23 ▲0.0596.55 ▼1.8942.00 ▼3.43
Required Product Categories /wp-admin/admin.php?page=wprtt_whats_new7682.0523.6722.91
Required Product Categories /wp-admin/admin.php?page=wprtt_welcome_page8022.0426.5324.71

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • wprtt_welcome_redirect
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=wprtt_whats_new
    • > Warning in wp-content/plugins/woo-require-categories-when-creating-products/vendor/vg-plugin-sdk/index.php+164
    include(/1.0.1.php): failed to open stream: No such file or directory
    • > GET request to /wp-admin/admin.php?page=wprtt_whats_new
    • > Warning in wp-content/plugins/woo-require-categories-when-creating-products/vendor/vg-plugin-sdk/index.php+164
    include(): Failed opening '/1.0.1.php' for inclusion (include_path='.:/usr/share/php')
    • > GET request to /wp-admin/admin.php?page=wprtt_whats_new
    • > Notice in wp-content/plugins/woo-require-categories-when-creating-products/vendor/vg-plugin-sdk/index.php+166
    Undefined variable: items
    • > GET request to /wp-admin/admin.php?page=wprtt_whats_new
    • > Warning in wp-content/plugins/woo-require-categories-when-creating-products/vendor/vg-plugin-sdk/index.php+182
    include(): Filename cannot be empty
    • > GET request to /wp-admin/admin.php?page=wprtt_whats_new
    • > Warning in wp-content/plugins/woo-require-categories-when-creating-products/vendor/vg-plugin-sdk/index.php+182
    include(): Failed opening '' for inclusion (include_path='.:/usr/share/php')

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/woo-require-categories-when-creating-products/index.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_create_nonce() in wp-content/plugins/woo-require-categories-when-creating-products/vendor/vg-plugin-sdk/views/page-template.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/woo-require-categories-when-creating-products/views/welcome-page-content.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/woo-require-categories-when-creating-products/vendor/vg-plugin-sdk/samples/email-optin-form.php:3

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

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes: You can take inspiration from this readme.txt

woo-require-categories-when-creating-products/index.php 92% from 13 tests

The principal PHP file in "Require Categories when Creating Products - WooCommerce" v. 1.0.1 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("woo-require-categories-when-creating-products.php" instead of "index.php")

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
Good job! No executable or dangerous file extensions detected557 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP512242469
CSS16048
JavaScript13540

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity19.50
▷ Minimum class complexity15.00
▷ Maximum class complexity24.00
Average method complexity2.68
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods22
▷ Static methods14.55%
▷ Public methods2195.45%
▷ Protected methods00.00%
▷ Private methods14.55%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
There are no PNG files in this plugin