94% color-or-image-variation-swatches-for-woocommerce

Code Review | Color or Image Variation Swatches for WooCommerce

WordPress plugin Color or Image Variation Swatches for WooCommerce scored 94% from 54 tests.

About plugin

  • Plugin page: color-or-image-va...
  • Plugin version: 1.1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-5.7
  • WordPress version: 5.8.1
  • First release: Apr 7, 2017
  • Latest release: Apr 17, 2021
  • Number of updates: 27
  • Update frequency: every 54.5 days
  • Top authors: algoritmika (88.89%)Karzin (14.81%)

Code review

54 tests

User reviews

9 reviews

Install metrics

1,000+ active / 15,548 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼140.63ms] Passed 4 tests

A check of server-side resources used by Color or Image Variation Swatches for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.0135.41 ▲1.35
Dashboard /wp-admin3.07 ▲0.0146.07 ▲0.90
Posts /wp-admin/edit.php3.12 ▲0.0142.10 ▲6.02
Add New Post /wp-admin/post-new.php5.43 ▼0.0186.38 ▼563.67
Media Library /wp-admin/upload.php3.01 ▲0.0130.09 ▼1.11

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 421 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Color or Image Variation Swatches for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,679 ▲8316.33 ▲0.4410.03 ▲1.0648.37 ▲4.79
Dashboard /wp-admin2,973 ▲425.85 ▼0.31138.19 ▲0.96115.83 ▼2.97
Posts /wp-admin/edit.php2,736 ▼32.68 ▼0.0066.95 ▲3.9293.69 ▲7.70
Add New Post /wp-admin/post-new.php1,500 ▼17218.62 ▼0.31365.95 ▼9.54106.29 ▼3.26
Media Library /wp-admin/upload.php1,807 ▼35.04 ▲0.03145.70 ▼9.11118.64 ▼8.82

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Uninstall script ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 39× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/CMB2_Options_Hookup.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Multi_Base' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Radio.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text_Date' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Text_Time.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Title.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Picker_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Picker_Base' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Text_Date.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Multi_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Base' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/CMB2_Field.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Select' not found in wp-content/plugins/color-or-image-variation-swatches-for-woocommerce/vendor/cmb2/cmb2/includes/types/CMB2_Type_Select_Timezone.php:13

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 96% 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
6 plugin tags: variation, woocommerce, image, swatches, attribute...

color-or-image-variation-swatches-for-woocommerce/color-or-image-variation-swatches-for-woocommerce.php 92% from 13 tests

The main PHP file in "Color or Image Variation Swatches for WooCommerce" ver. 1.1.4 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.4" instead of "3.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin50,121 lines of code in 258 files:
LanguageFilesBlank linesComment linesLines of code
PO File12114,33518,52732,404
PHP852,6477,1639,095
CSS142571,2044,592
JavaScript103796581,572
Sass20316291,470
Markdown32440755
JSON500233

PHP code Passed 2 tests

A short 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.48
Average class complexity17.87
▷ Minimum class complexity1.00
▷ Maximum class complexity188.00
Average method complexity3.24
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes86
▷ Abstract classes910.47%
▷ Concrete classes7789.53%
▷ Final classes00.00%
Methods652
▷ Static methods11317.33%
▷ Public methods55184.51%
▷ Protected methods9314.26%
▷ Private methods81.23%
Functions44
▷ Named functions4193.18%
▷ Anonymous functions36.82%
Constants16
▷ Global constants743.75%
▷ Class constants956.25%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
14 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/cmb2/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
vendor/cmb2/cmb2/images/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%
vendor/cmb2/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
vendor/cmb2/cmb2/images/ui-bg_flat_75_ffffff_40x100.png0.17KB0.08KB▼ 51.12%
vendor/cmb2/cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%