73% variable-product-swatches

Code Review | Variable Product Swatches for WooCommerce

WordPress plugin Variable Product Swatches for WooCommerce scored73%from 54 tests.

About plugin

  • Plugin page: variable-product-...
  • Plugin version: 1.0.4
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.0
  • WordPress version: 6.3.1
  • First release: Jan 13, 2022
  • Latest release: Oct 1, 2022
  • Number of updates: 19
  • Update frequency: every 13.8 days
  • Top authors: zqelab (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /777 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲5.14MB] [CPU: ▲21.60ms] 75% from 4 tests

A check of server-side resources used by Variable Product Swatches for WooCommerce
It is recommended to improve the following
  • Extra RAM: The extra memory usage must be under 5MB (currently 5.14MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /8.86 ▲5.4070.10 ▲23.74
Dashboard /wp-admin8.88 ▲5.5884.46 ▲32.56
Posts /wp-admin/edit.php8.88 ▲5.5379.64 ▲22.00
Add New Post /wp-admin/post-new.php9.94 ▲4.06106.22 ▲8.09
Media Library /wp-admin/upload.php8.88 ▲5.6570.55 ▲33.36
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.8866.55

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 215 new files
Database: no new tables, 10 new options
New WordPress options
fs_accounts
widget_recent-posts
widget_recent-comments
fs_active_plugins
fs_debug_mode
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
fs_gdpr
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Variable Product Swatches for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,144 ▲38314.82 ▲0.471.95 ▲0.1932.35 ▼13.88
Dashboard /wp-admin2,542 ▲3686.45 ▲0.87125.45 ▲22.9445.11 ▲1.32
Posts /wp-admin/edit.php2,367 ▲2703.70 ▲1.6853.54 ▲19.0233.27 ▼5.92
Add New Post /wp-admin/post-new.php1,598 ▲7023.29 ▲0.15628.75 ▼53.4932.67 ▼25.39
Media Library /wp-admin/upload.php1,503 ▲1034.34 ▲0.2382.93 ▼35.9542.91 ▼5.24
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,3003.2545.3125.49

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/variable-product-swatches/includes/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • This plugin does not fully uninstall, leaving 10 options in the database
    • fs_accounts
    • fs_active_plugins
    • fs_debug_mode
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • fs_gdpr
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 75% 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 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
Please take a closer look at the following
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/variable-product-swatches/public/partials/variable-product-swatches-public-display.php
    • > /wp-content/plugins/variable-product-swatches/admin/partials/variable-product-swatches-admin-display.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% 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:
  • Tags: There are too many tags (15 tag instead of maximum 10)
The official readme.txt is a good inspiration

variable-product-swatches/variable-product-swatches.php Passed 13 tests

The main PHP file in "Variable Product Swatches for WooCommerce" ver. 1.0.4 adds more information about the plugin and also serves as the entry point for this plugin
135 characters long description:
Variable Product Swatches is altimate solution for Color, Image, Button and Radio Swatches For WooCommerce Variable Product Attributes.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
No dangerous file extensions were detected34,213 lines of code in 161 files:
LanguageFilesBlank linesComment linesLines of code
PHP1337,70517,25332,568
JavaScript8601881,080
CSS1556243
Markdown1680214
JSON300107
SVG1201

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
Please fix the following
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,911)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity73.28
▷ Minimum class complexity1.00
▷ Maximum class complexity2,911.00
Average method complexity4.50
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes60
▷ Abstract classes23.33%
▷ Concrete classes5896.67%
▷ Final classes00.00%
Methods1,272
▷ Static methods19615.41%
▷ Public methods92172.41%
▷ Protected methods151.18%
▷ Private methods33626.42%
Functions101
▷ Named functions9897.03%
▷ Anonymous functions32.97%
Constants127
▷ Global constants10280.31%
▷ Class constants2519.69%
▷ Public constants25100.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
4 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
includes/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
includes/freemius/assets/img/variable-product-swatches.png9.16KB5.26KB▼ 42.58%
includes/freemius/assets/img/woo-variable-product-swatches.png9.16KB5.26KB▼ 42.58%