67% premmerce-woocommerce-variation-swatches

Code Review | Premmerce Variation Swatches for WooCommerce

WordPress plugin Premmerce Variation Swatches for WooCommerce scored67%from 54 tests.

About plugin

  • Plugin page: premmerce-woocomm...
  • Plugin version: 1.2.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.3
  • WordPress version: 6.3.1
  • First release: Feb 13, 2019
  • Latest release: Aug 11, 2023
  • Number of updates: 25
  • Update frequency: every 66.6 days
  • Top authors: premmerce (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active /15,245 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲5.41MB] [CPU: ▲18.02ms] 75% from 4 tests

A check of server-side resources used by Premmerce Variation Swatches for WooCommerce
The following require your attention
  • Extra RAM: Extra memory usage should kept under 5MB (currently 5.41MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.25 ▲5.7962.54 ▲18.66
Dashboard /wp-admin9.27 ▲5.9769.30 ▲20.23
Posts /wp-admin/edit.php9.27 ▲5.9167.40 ▲19.01
Add New Post /wp-admin/post-new.php9.86 ▲3.97112.75 ▲14.19
Media Library /wp-admin/upload.php9.27 ▲6.0465.10 ▲29.61
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius9.2757.50

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 353 new files
Database: 1 new table, 11 new options
New tables
wp_premmerce_attributes
New WordPress options
premmerce_main_attributes
widget_theysaidso_widget
fs_debug_mode
db_upgraded
can_compress_scripts
premmerce_advanced_attributes_db_version
widget_recent-posts
fs_active_plugins
fs_accounts
widget_recent-comments
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Premmerce Variation Swatches for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7914.80 ▲0.151.68 ▼0.1832.80 ▼11.42
Dashboard /wp-admin2,231 ▲634.87 ▼0.20113.18 ▲7.9549.55 ▲5.90
Posts /wp-admin/edit.php2,113 ▲242.06 ▲0.0934.92 ▼4.8832.70 ▼4.77
Add New Post /wp-admin/post-new.php1,540 ▲123.08 ▼0.27651.19 ▼36.4661.24 ▲7.45
Media Library /wp-admin/upload.php1,416 ▲254.25 ▲0.1697.43 ▼10.7146.44 ▼0.78
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,0781.7126.1829.29

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/premmerce-woocommerce-variation-swatches/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • Zombie WordPress options detected upon uninstall: 11 options
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • fs_accounts
    • fs_debug_mode
    • premmerce_main_attributes
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • fs_active_plugins
    • can_compress_scripts
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
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 fix the following items
  • 6× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/color.php
    • > /wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/bicolor.php
    • > /wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/radio.php
    • > /wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/label.php
    • > /wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/image.php
    • > /wp-content/plugins/premmerce-woocommerce-variation-swatches/views/frontend/variation-wrapper.php
  • 24× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/radio.php on line 6
    • > PHP Fatal error
      Uncaught Error: Interface 'Premmerce\\Attributes\\Admin\\Tabs\\Base\\TabInterface' not found in wp-content/plugins/premmerce-woocommerce-variation-swatches/src/Admin/Tabs/SimpleTab.php:7
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/color.php on line 11
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/bicolor.php on line 10
    • > PHP Fatal error
      Uncaught Error: Interface 'Premmerce\\Attributes\\Admin\\Tabs\\Base\\TabInterface' not found in wp-content/plugins/premmerce-woocommerce-variation-swatches/src/Admin/Tabs/BundleAndSave.php:6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/color.php on line 11
    • > PHP Fatal error
      Uncaught Error: Interface 'Premmerce\\Attributes\\Admin\\Tabs\\Base\\TabInterface' not found in wp-content/plugins/premmerce-woocommerce-variation-swatches/src/Admin/Tabs/Base/BaseSettings.php:3
    • > PHP Notice
      Undefined variable: options in wp-content/plugins/premmerce-woocommerce-variation-swatches/views/woocommerce/variations/color.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'Premmerce\\Attributes\\Admin\\Tabs\\Base\\BaseSettings' not found in wp-content/plugins/premmerce-woocommerce-variation-swatches/src/Admin/Tabs/Settings.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_kses_post() in wp-content/plugins/premmerce-woocommerce-variation-swatches/views/frontend/attribute-description.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: variation swatches, woocommerce attributes, image attributes, catalog purchase, extended attributes...

premmerce-woocommerce-variation-swatches/premmerce-advanced-attributes.php 77% from 13 tests

The main PHP file in "Premmerce Variation Swatches for WooCommerce" ver. 1.2.2 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("premmerce-woocommerce-variation-swatches.php" instead of "premmerce-advanced-attributes.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Requires at least: Required version must be the same as the one declared in readme.txt ("5.0" instead of "3.0.0")

Code Analysis 97% from 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
Good job! No executable or dangerous file extensions detected95,816 lines of code in 250 files:
LanguageFilesBlank linesComment linesLines of code
JSON40042,246
PHP1788,68318,26236,293
CSS181,16921110,165
JavaScript397464513,398
PO File54655781,651
Sass1229141,328
SVG302628
Markdown2660107

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity69.97
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.33
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces11
Interfaces2
Traits0
Classes65
▷ Abstract classes34.62%
▷ Concrete classes6295.38%
▷ Final classes00.00%
Methods1,433
▷ Static methods24016.75%
▷ Public methods1,03572.23%
▷ Protected methods181.26%
▷ Private methods38026.52%
Functions117
▷ Named functions10589.74%
▷ Anonymous functions1210.26%
Constants158
▷ Global constants9862.03%
▷ Class constants6037.97%
▷ Public constants60100.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
39 PNG files occupy 0.85MB with 0.42MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/premmerce-pricing-page/src/assets/img/mastercard.png1.63KB1.49KB▼ 8.47%
assets/admin/js/pricing-page/4375c4a3ddc6f637c2ab9a2d7220f91e.png9.16KB5.26KB▼ 42.58%
assets/admin/img/permalink.png25.02KB9.05KB▼ 63.85%
assets/admin/img/variants.png26.28KB9.68KB▼ 63.17%
assets/premmerce-pricing-page/src/assets/img/comodo-short-green.png11.80KB3.94KB▼ 66.64%