77% color-and-image-swatches-for-variable-product-attributes

Code Review | Color and Image Swatches for Variable Product Attributes

WordPress plugin Color and Image Swatches for Variable Product Attributes scored77%from 54 tests.

About plugin

  • Plugin page: color-and-image-s...
  • Plugin version: 2.0.6
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6.0-5.6
  • WordPress version: 6.3.1
  • First release: Apr 29, 2016
  • Latest release: Dec 16, 2020
  • Number of updates: 156
  • Update frequency: every 10.9 days
  • Top authors: phoeniixx (100%)

Code review

54 tests

User reviews

20 reviews

Install metrics

2,000+ active /94,445 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

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

A check of server-side resources used by Color and Image Swatches for Variable Product Attributes
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0046.21 ▼0.45
Dashboard /wp-admin3.31 ▲0.0044.96 ▼1.75
Posts /wp-admin/edit.php3.36 ▲0.0048.35 ▲2.30
Add New Post /wp-admin/post-new.php5.89 ▲0.0085.00 ▼14.77
Media Library /wp-admin/upload.php3.23 ▲0.0034.58 ▲1.23

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 87 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Color and Image Swatches for Variable Product Attributes
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.33 ▼1.061.91 ▼0.0739.86 ▼2.89
Dashboard /wp-admin2,209 ▲185.86 ▲0.95102.99 ▼1.8438.89 ▲0.68
Posts /wp-admin/edit.php2,089 ▼31.99 ▼0.0536.09 ▼4.8135.29 ▼1.47
Add New Post /wp-admin/post-new.php1,520 ▼023.30 ▲0.17677.25 ▲77.6659.26 ▲11.01
Media Library /wp-admin/upload.php1,391 ▼04.21 ▼0.0598.57 ▲2.4043.20 ▼0.13

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts

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 no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 4× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/color-and-image-swatches-for-variable-product-attributes/include/support.php
    • > /wp-content/plugins/color-and-image-swatches-for-variable-product-attributes/include/woocommerce-app.php
    • > /wp-content/plugins/color-and-image-swatches-for-variable-product-attributes/include/premium-tab.php
    • > /wp-content/plugins/color-and-image-swatches-for-variable-product-attributes/include/how-to-install.php
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/color-and-image-swatches-for-variable-product-attributes/include/general-settings.php:32

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

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 22 tag instead of maximum 10
You can take inspiration from this readme.txt

color-and-image-swatches-for-variable-product-attributes/plugin.php 69% from 13 tests

"Color and Image Swatches for Variable Product Attributes" version 2.0.6's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Requires at least: Required version does not match the one declared in readme.txt ("4.0" instead of "2.6.0")
  • Description: The description should be shorter than 140 characters (currently 146 characters long)
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("color-and-image-swatches-for-variable-product-attributes.php" instead of "plugin.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
There were no executable files found in this plugin8,197 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript51,2734955,801
PHP10971651,674
CSS35638722

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity21.00
▷ Minimum class complexity19.00
▷ Maximum class complexity25.00
Average method complexity3.14
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods28
▷ Static methods00.00%
▷ Public methods28100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
47 PNG files occupy 1.14MB with 0.63MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/fill_check.png2.03KB0.80KB▼ 60.58%
assets/images/Icon-5.png3.86KB2.99KB▼ 22.66%
images/product view page.png91.39KB33.99KB▼ 62.81%
assets/images/screenshot-2.png62.66KB22.93KB▼ 63.40%
assets/images/App-2-3.png71.93KB23.52KB▼ 67.31%