78% th-variation-swatches

Code Review | Variation Swatches for WooCommerce

WordPress plugin Variation Swatches for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: th-variation-swat...
  • Plugin version: 1.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-6.3.2
  • WordPress version: 6.3.1
  • First release: Jul 22, 2021
  • Latest release: Nov 3, 2023
  • Number of updates: 23
  • Update frequency: every 36.3 days
  • Top authors: themehunk (100%)

Code review

54 tests

User reviews

1 review

Install metrics

6,000+ active /83,125 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.57MB] [CPU: ▲3.44ms] Passed 4 tests

Analyzing server-side resources used by Variation Swatches for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.01 ▲0.5542.71 ▲0.85
Dashboard /wp-admin3.93 ▲0.6357.69 ▲6.45
Posts /wp-admin/edit.php3.98 ▲0.6360.35 ▲13.44
Add New Post /wp-admin/post-new.php6.44 ▲0.5694.61 ▼0.31
Media Library /wp-admin/upload.php3.77 ▲0.5439.16 ▲6.76
ThemeHunk /wp-admin/admin.php?page=themehunk-plugins3.8041.82
Variation Swatches /wp-admin/admin.php?page=th-variation-swatches3.7638.02

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 38 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Variation Swatches for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,979 ▲23214.69 ▲0.481.74 ▼0.1845.91 ▲3.64
Dashboard /wp-admin2,372 ▲1956.49 ▲0.82114.50 ▲15.1582.13 ▲38.07
Posts /wp-admin/edit.php2,309 ▲2093.58 ▲1.5855.91 ▲17.8771.40 ▲36.80
Add New Post /wp-admin/post-new.php1,570 ▲4123.32 ▲0.25553.49 ▼114.79182.75 ▲123.80
Media Library /wp-admin/upload.php1,449 ▲494.42 ▲0.2783.85 ▼17.1483.23 ▲39.88
ThemeHunk /wp-admin/admin.php?page=themehunk-plugins1,4263.4250.5785.07
Variation Swatches /wp-admin/admin.php?page=th-variation-swatches9993.3744.2524.11

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/th-variation-swatches/inc/thvs-meta.php
  • 11× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/th-option/tab-html.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/plugins-list.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/admin-menu.php:4
    • > PHP Warning
      Use of undefined constant THEMEHUNK_PDIR - assumed 'THEMEHUNK_PDIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/th-option/tab-html.php on line 9
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/admin-menu.php on line 3
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin-install.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/admin-menu.php on line 3
    • > PHP Warning
      include_once(): Failed opening 'THEMEHUNK_PDIRth-option/header.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/th-option/tab-html.php on line 9
    • > PHP Warning
      include_once(THEMEHUNK_PDIRth-option/header.php): failed to open stream: No such file or directory in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/th-option/tab-html.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/th-option/sidebar.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/th-variation-swatches/inc/themehunk-menu/th-option/header.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention: The official readme.txt might help

th-variation-swatches/th-variation-swatches.php 92% from 13 tests

"Variation Swatches for WooCommerce" version 1.3.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 389 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin4,626 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP137341302,521
CSS384241,089
JavaScript42553141,016

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity50.75
▷ Minimum class complexity11.00
▷ Maximum class complexity119.00
Average method complexity3.54
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods77
▷ Static methods67.79%
▷ Public methods6483.12%
▷ Protected methods00.00%
▷ Private methods1316.88%
Functions36
▷ Named functions3186.11%
▷ Anonymous functions513.89%
Constants9
▷ Global constants9100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
16 PNG files occupy 0.58MB with 0.31MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/pro3.png44.26KB46.14KB0.00%
images/icon.png8.40KB0.67KB▼ 91.99%
inc/themehunk-menu/th-option/assets/images/icon.png14.32KB7.45KB▼ 47.95%
images/placeholder.png3.15KB1.12KB▼ 64.47%
images/pro-coming-soonb.png6.51KB2.33KB▼ 64.23%