83% swatchly

Code Review | Swatchly – WooCommerce Variation Swatches for Products (product attributes: Image swatch, Color swatches, Label swatches)

WordPress plugin Swatchly – WooCommerce Variation Swatches for Products (product attributes: Image swatch, Color swatches, Label swatches) scored83%from 54 tests.

About plugin

  • Plugin page: swatchly
  • Plugin version: 1.2.3
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.4
  • WordPress version: 6.3.1
  • First release: Jun 10, 2021
  • Latest release: Nov 2, 2023
  • Number of updates: 47
  • Update frequency: every 18.6 days
  • Top authors: hasthemes (100%)

Code review

54 tests

User reviews

15 reviews

Install metrics

6,000+ active /55,259 total downloads

Benchmarks

Plugin footprint 82% 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: ▲1.56MB] [CPU: ▲7.96ms] 75% from 4 tests

Server-side resources used by Swatchly – WooCommerce Variation Swatches for Products (product attributes: Image swatch, Color swatches, Label swatches)
Please fix the following
  • CPU: Try to keep total CPU usage under 500.00ms (currently 2,223.89ms on /wp-admin/admin.php?page=swatchly_recommendations)
PageMemory (MB)CPU Time (ms)
Home /4.95 ▲1.4946.76 ▲5.00
Dashboard /wp-admin4.89 ▲1.5960.42 ▲8.90
Posts /wp-admin/edit.php4.94 ▲1.5865.46 ▲16.53
Add New Post /wp-admin/post-new.php7.48 ▲1.58104.81 ▲1.42
Media Library /wp-admin/upload.php4.82 ▲1.5852.77 ▲16.67
Recommendations /wp-admin/admin.php?page=swatchly_recommendations9.102,223.89

Server storage [IO: ▲1.45MB] [DB: ▲0.70MB] Passed 3 tests

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 163 new files
Database: no new tables, 8 new options
New WordPress options
swatchly_version
swatchly_installed
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Swatchly – WooCommerce Variation Swatches for Products (product attributes: Image swatch, Color swatches, Label swatches)
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,822 ▲6114.23 ▼0.031.77 ▼0.1340.95 ▼7.03
Dashboard /wp-admin2,200 ▲235.63 ▲0.0387.44 ▼7.9939.55 ▲1.15
Posts /wp-admin/edit.php2,108 ▲81.98 ▲0.0339.48 ▲2.5436.86 ▲5.18
Add New Post /wp-admin/post-new.php1,534 ▼123.89 ▲5.48606.90 ▲3.9246.07 ▼19.01
Media Library /wp-admin/upload.php1,408 ▲114.16 ▼0.04100.05 ▼2.8343.32 ▼1.01
Recommendations /wp-admin/admin.php?page=swatchly_recommendations2,8722.1726.2640.86

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • swatchly_version
    • swatchly_installed

Smoke tests 75% 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 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
Please fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Swatchly\\Admin\\esc_html__() in wp-content/plugins/swatchly/includes/Admin/recommendations/Recommended_Plugins.php:71

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 97% 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
These attributes need to be fixed:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

swatchly/swatchly.php Passed 13 tests

"Swatchly – WooCommerce Variation Swatches for Products (product attributes: Image swatch, Color swatches, Label swatches)" version 1.2.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
43 characters long description:
Variation Swatches for WooCommerce Products

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin26,450 lines of code in 136 files:
LanguageFilesBlank linesComment linesLines of code
PHP1003,1191,93011,478
JavaScript111,5597225,396
Sass1595234,811
CSS63815194,744
JSON20019
SVG2002

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity26.22
▷ Minimum class complexity1.00
▷ Maximum class complexity207.00
Average method complexity6.05
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces7
Interfaces0
Traits0
Classes76
▷ Abstract classes22.63%
▷ Concrete classes7497.37%
▷ Final classes11.35%
Methods350
▷ Static methods6518.57%
▷ Public methods34598.57%
▷ Protected methods00.00%
▷ Private methods51.43%
Functions39
▷ Named functions3487.18%
▷ Anonymous functions512.82%
Constants5
▷ Global constants5100.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
22 PNG files occupy 0.12MB with 0.11MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
(invalid) includes/Admin/recommendations/assets/images/extensions/wp-plugin-manager-pro.png13.31KB0.00KB▼ 100.00%
(invalid) includes/Admin/recommendations/assets/images/extensions/ht-google-place-review.png2.64KB0.00KB▼ 100.00%
includes/Admin/recommendations/assets/images/extensions/whols-pro.png15.30KB7.40KB▼ 51.65%
assets/images/rounded.png2.08KB0.46KB▼ 78.03%
(invalid) includes/Admin/recommendations/assets/images/extensions/docus-pro.png3.98KB0.00KB▼ 100.00%