83% variation-swatches-style

Code Review | Smart WooCommerce Swatches, Photos And Filter by Attribute

WordPress plugin Smart WooCommerce Swatches, Photos And Filter by Attribute scored83%from 54 tests.

About plugin

  • Plugin page: variation-swatche...
  • Plugin version: 1.3.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3-6.1.7
  • WordPress version: 6.3.1
  • First release: Nov 6, 2017
  • Latest release: Oct 11, 2023
  • Number of updates: 81
  • Update frequency: every 26.8 days
  • Top authors: athemeart (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

5,000+ active /158,194 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.03MB] [CPU: ▼11.45ms] Passed 4 tests

This is a short check of server-side resources used by Smart WooCommerce Swatches, Photos And Filter by Attribute
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0344.55 ▲3.44
Dashboard /wp-admin3.34 ▲0.0357.97 ▲3.88
Posts /wp-admin/edit.php3.39 ▲0.0346.36 ▼5.95
Add New Post /wp-admin/post-new.php5.92 ▲0.0384.16 ▼41.18
Media Library /wp-admin/upload.php3.26 ▲0.0337.88 ▼2.12

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 28 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Smart WooCommerce Swatches, Photos And Filter by Attribute: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,820 ▲5914.63 ▲0.292.06 ▲0.0640.37 ▼7.48
Dashboard /wp-admin2,201 ▲245.65 ▼0.0184.66 ▼18.8943.59 ▼1.34
Posts /wp-admin/edit.php2,107 ▲72.01 ▲0.0635.56 ▼3.6934.04 ▼2.63
Add New Post /wp-admin/post-new.php1,532 ▲623.52 ▲0.41654.01 ▼123.9658.53 ▲3.94
Media Library /wp-admin/upload.php1,400 ▼04.22 ▲0.0498.45 ▼21.6741.36 ▼10.34

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not 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
Almost there! Just fix the following items
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/variation-swatches-style/inc/plugins-settings.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/variation-swatches-style/inc/tutorials.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/variation-swatches-style/inc/widgets-helper.php:17

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 88% 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: Please reduce the number of tags, currently 15 tag instead of maximum 10
  • Screenshots: These screenshots do not have images: #1 (Variations on frontend), #2 (Add new attribute), #3 (Edit Attribute), #4 (Attribute color), #5 (Variations Options)
Please take inspiration from this readme.txt

variation-swatches-style/smart-variation-swatches-for-woocommerce.php 77% from 13 tests

The principal PHP file in "Smart WooCommerce Swatches, Photos And Filter by Attribute" v. 1.3.7 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("variation-swatches-style.php" instead of "smart-variation-swatches-for-woocommerce.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Requires at least: Required version number should use periods and dots only (ex. "7.0" instead of "3")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin2,889 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP127437402,339
CSS25312397
JavaScript26427153

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity52.22
▷ Minimum class complexity2.00
▷ Maximum class complexity143.00
Average method complexity5.27
▷ Minimum method complexity1.00
▷ Maximum method complexity48.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes111.11%
Methods108
▷ Static methods65.56%
▷ Public methods108100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
9 PNG files occupy 0.76MB with 0.45MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-5.png37.92KB12.06KB▼ 68.20%
screenshot-2.png365.96KB131.93KB▼ 63.95%
assets/img/archive_swatches.png26.84KB15.23KB▼ 43.28%
screenshot.png132.29KB51.50KB▼ 61.07%
screenshot-1.png132.29KB51.50KB▼ 61.07%