10% force-default-variant-for-woocommerce

Code Review | WooCommerce Force Default Variant

WordPress plugin WooCommerce Force Default Variant scored10%from 54 tests.

About plugin

  • Plugin page: force-default-var...
  • Plugin version: 1.8
  • PHP version: 7.4.16
  • WordPress compatibility: 2.4-6.3.2
  • WordPress version: 6.3.1
  • First release: Nov 24, 2015
  • Latest release: Oct 27, 2023
  • Number of updates: 31
  • Update frequency: every 93.4 days
  • Top authors: HappyKite (100%)

Code review

54 tests

User reviews

18 reviews

Install metrics

4,000+ active /38,475 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • The plugin did not install without errors
    • > Warning in wp-admin/includes/plugin.php+294
    opendir(wp-content/plugins/woocommerce): failed to open dir: No such file or directory

Server metrics [RAM: ▲0.00MB] [CPU: ▼3.32ms] Passed 4 tests

This is a short check of server-side resources used by WooCommerce Force Default Variant
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0037.68 ▼0.57
Dashboard /wp-admin3.31 ▲0.0046.18 ▼4.60
Posts /wp-admin/edit.php3.36 ▲0.0047.42 ▲4.89
Add New Post /wp-admin/post-new.php5.89 ▲0.0080.07 ▼8.44
Media Library /wp-admin/upload.php3.23 ▲0.0034.24 ▲0.32

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 6 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
hpy_plugin_deferred_admin_notices
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for WooCommerce Force Default Variant
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.14 ▼0.391.81 ▲0.0644.21 ▼1.09
Dashboard /wp-admin2,198 ▲215.60 ▲0.0390.11 ▼12.7942.07 ▼0.49
Posts /wp-admin/edit.php2,100 ▲31.98 ▼0.0333.31 ▼2.2334.70 ▲4.85
Add New Post /wp-admin/post-new.php1,526 ▼023.46 ▲0.39676.58 ▲29.7465.47 ▲7.43
Media Library /wp-admin/upload.php1,403 ▲94.22 ▲0.0197.52 ▲5.3343.01 ▲1.23

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
These items require your attention
  • Zombie WordPress options detected upon uninstall: 7 options
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • hpy_plugin_deferred_admin_notices
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 6× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function hpy_fdv_wc_version_check() in wp-content/plugins/force-default-variant-for-woocommerce/includes/variations.php:2
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/force-default-variant-for-woocommerce/woo-force-default-variant.php on line 44
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/plugin.php' (include_path='.:/usr/share/php') in wp-content/plugins/force-default-variant-for-woocommerce/woo-force-default-variant.php on line 44
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/force-default-variant-for-woocommerce/includes/clear-removal.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/force-default-variant-for-woocommerce/includes/settings.php:6
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/force-default-variant-for-woocommerce/woo-force-default-variant.php on line 44

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

readme.txt Passed 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
4 plugin tags: woocommerce variant, woocommerce, variable product, ecommerce

force-default-variant-for-woocommerce/woo-force-default-variant.php 85% from 13 tests

The entry point to "WooCommerce Force Default Variant" version 1.8 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Requires at least: Required version does not match the one declared in readme.txt ("4.2" instead of "2.4")
  • Main file name: Name the main plugin file the same as the plugin slug ("force-default-variant-for-woocommerce.php" instead of "woo-force-default-variant.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
No dangerous file extensions were detected481 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP513095481

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.40
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%
Functions30
▷ Named functions2893.33%
▷ Anonymous functions26.67%
Constants0
▷ Global constants00.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
There were not PNG files found in your plugin