61% gs-woo-variation-swatches

Code Review | GS Variation Swatches for WooCommerce

WordPress plugin GS Variation Swatches for WooCommerce scored61%from 54 tests.

About plugin

  • Plugin page: gs-woo-variation-...
  • Plugin version: 1.6.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-6.3
  • WordPress version: 6.3.1
  • First release: Feb 10, 2018
  • Latest release: Aug 31, 2023
  • Number of updates: 49
  • Update frequency: every 41.4 days
  • Top authors: samdani (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

100+ active /15,525 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.37MB] [CPU: ▼4.79ms] 75% from 4 tests

Server-side resources used by GS Variation Swatches for WooCommerce
The following require your attention
  • CPU: Total CPU usage must kept under 500.00ms (currently 1,007.84ms on /wp-admin/admin.php?page=gsp-main)
PageMemory (MB)CPU Time (ms)
Home /3.85 ▲0.3942.48 ▲2.55
Dashboard /wp-admin3.71 ▲0.4145.77 ▼8.85
Posts /wp-admin/edit.php3.76 ▲0.4044.00 ▼6.91
Add New Post /wp-admin/post-new.php6.23 ▲0.3495.78 ▼5.94
Media Library /wp-admin/upload.php3.57 ▲0.3441.08 ▲7.33
GS Plugins FREE /wp-admin/admin.php?page=gs-plugins-free3.67707.43
Variation Help & Usage /wp-admin/admin.php?page=gs-wv-help3.5335.38
GS Plugins /wp-admin/admin.php?page=gsp-main3.851,007.84

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 19 new files
Database: 1 new table, 6 new options
New tables
wp_gs_woo_meta
New WordPress options
can_compress_scripts
widget_recent-posts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for GS Variation Swatches for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,862 ▲12713.68 ▼0.691.76 ▲0.0544.68 ▲0.06
Dashboard /wp-admin2,268 ▲794.79 ▼0.10101.51 ▼3.0041.87 ▼3.22
Posts /wp-admin/edit.php2,154 ▲622.15 ▲0.1740.48 ▼10.4037.69 ▲0.56
Add New Post /wp-admin/post-new.php1,585 ▲4923.26 ▲0.20604.27 ▼1.2254.31 ▼3.32
Media Library /wp-admin/upload.php1,450 ▲624.25 ▲0.05101.31 ▲5.0542.20 ▲1.10
GS Plugins FREE /wp-admin/admin.php?page=gs-plugins-free2,6772.0630.4340.41
Variation Help & Usage /wp-admin/admin.php?page=gs-wv-help1,0283.7656.9063.38
GS Plugins /wp-admin/admin.php?page=gsp-main1,9252.0327.1558.55

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_gs_woo_meta
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/gs-woo-variation-swatches/includes/class-woo-frontend.php
    • > /wp-content/plugins/gs-woo-variation-swatches/includes/templates/admin/function.activation.php
    • > /wp-content/plugins/gs-woo-variation-swatches/includes/class-woov-setting.php
  • 8× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gs-woo-variation-swatches/gs-plugins/gs-plugins-free.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/gs-woo-variation-swatches/gs_woo_variation.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/gs-woo-variation-swatches/includes/templates/gs-variable-loop.php:11
    • > PHP Warning
      Use of undefined constant GS_WOO_HACK_MSG - assumed 'GS_WOO_HACK_MSG' (this will throw an Error in a future version of PHP) in wp-content/plugins/gs-woo-variation-swatches/includes/class-woov-setting.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gs-woo-variation-swatches/gs-plugins/gs-plugins.php:15
    • > PHP Warning
      Use of undefined constant GS_WOO_HACK_MSG - assumed 'GS_WOO_HACK_MSG' (this will throw an Error in a future version of PHP) in wp-content/plugins/gs-woo-variation-swatches/includes/class-woo-frontend.php on line 10
    • > PHP Warning
      Use of undefined constant GS_WOO_HACK_MSG - assumed 'GS_WOO_HACK_MSG' (this will throw an Error in a future version of PHP) in wp-content/plugins/gs-woo-variation-swatches/includes/templates/admin/function.activation.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gs-woo-variation-swatches/gs-plugins/gs-wv-help.php:15

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following user-side errors
    • > GET request to /wp-admin/admin.php?page=gs-wv-help
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/admin.php?page=gs-wv-help
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.

Optimizations

Plugin configuration 86% 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
These attributes need to be fixed:
  • Tags: Too many tags (35 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

gs-woo-variation-swatches/gs_woo_variation.php 77% from 13 tests

The main file in "GS Variation Swatches for WooCommerce" v. 1.6.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 339 characters long)
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("gs-woo-variation-swatches.php" instead of "gs_woo_variation.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin3,368 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP126198132,231
CSS35431571
JavaScript216579566

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity39.71
▷ Minimum class complexity2.00
▷ Maximum class complexity103.00
Average method complexity3.66
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods102
▷ Static methods65.88%
▷ Public methods8179.41%
▷ Protected methods87.84%
▷ Private methods1312.75%
Functions22
▷ Named functions22100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/img/icon-128x128.png13.98KB7.02KB▼ 49.75%