78% aco-variation-swatches-for-woocommerce

Code Review | Aco Variation Swatches for WooCommerce

WordPress plugin Aco Variation Swatches for WooCommerce scored 78% from 54 tests.

About plugin

  • Plugin page: aco-variation-swa...
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.9
  • WordPress version: 5.9.2
  • First release: May 5, 2021
  • Latest release: Mar 10, 2022
  • Number of updates: 10
  • Update frequency: every 31.0 days
  • Top authors: acowebscd (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 716 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
Installer ran successfully

Server metrics [RAM: ▲0.31MB] [CPU: ▼296.68ms] Passed 4 tests

An overview of server-side resources used by Aco Variation Swatches for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.86 ▲0.3453.77 ▲2.66
Dashboard /wp-admin3.74 ▲0.3334.79 ▲1.67
Posts /wp-admin/edit.php3.96 ▲0.3236.47 ▲0.92
Add New Post /wp-admin/post-new.php7.21 ▲0.2493.99 ▼1,190.98
Media Library /wp-admin/upload.php3.62 ▲0.3226.20 ▲1.67

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 26 new files
Database: no new tables, 1 new option
New WordPress options
acovsw_version

Browser metrics Passed 4 tests

Aco Variation Swatches for WooCommerce: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,763 ▲1015.84 ▲0.095.62 ▼1.592.31 ▼0.09
Dashboard /wp-admin2,894 ▲336.11 ▼0.14127.41 ▼3.58168.24 ▲9.66
Posts /wp-admin/edit.php2,688 ▼03.24 ▲0.0162.51 ▼0.17137.44 ▼3.31
Add New Post /wp-admin/post-new.php1,760 ▲9922.24 ▲5.53410.60 ▼8.93158.17 ▲3.18
Media Library /wp-admin/upload.php1,698 ▼05.54 ▲0.03137.40 ▲1.24185.38 ▼2.52

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
  • This plugin does not fully uninstall, leaving 1 option in the database
    • acovsw_version

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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 take a closer look at the following
  • 3× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/aco-variation-swatches-for-woocommerce/includes/views/admin-settings.php
    • > /wp-content/plugins/aco-variation-swatches-for-woocommerce/includes/views/admin-attributes.php
    • > /wp-content/plugins/aco-variation-swatches-for-woocommerce/includes/views/admin-product.php
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_bloginfo() in wp-content/plugins/aco-variation-swatches-for-woocommerce/start.php:22
    • > PHP Warning
      Use of undefined constant ACOVSW_TOKEN - assumed 'ACOVSW_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-variation-swatches-for-woocommerce/includes/views/admin-attributes.php on line 1
    • > PHP Warning
      Use of undefined constant ACOVSW_TOKEN - assumed 'ACOVSW_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-variation-swatches-for-woocommerce/includes/views/admin-settings.php on line 1
    • > PHP Warning
      Use of undefined constant ACOVSW_TOKEN - assumed 'ACOVSW_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-variation-swatches-for-woocommerce/includes/views/admin-product.php on line 1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% 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:
  • Donate link: Invalid URI found ("")
The official readme.txt is a good inspiration

aco-variation-swatches-for-woocommerce/start.php 92% from 13 tests

Analyzing the main PHP file in "Aco Variation Swatches for WooCommerce" version 1.1.0
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("aco-variation-swatches-for-woocommerce.php" instead of "start.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin1,842 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP83122721,261
PO File2144144296
CSS2107215
JavaScript212557
SVG10013

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 163)
Cyclomatic complexity
Average complexity per logical line of code0.64
Average class complexity106.75
▷ Minimum class complexity5.00
▷ Maximum class complexity205.00
Average method complexity10.00
▷ Minimum method complexity1.00
▷ Maximum method complexity163.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods48
▷ Static methods48.33%
▷ Public methods4797.92%
▷ Protected methods00.00%
▷ Private methods12.08%
Functions4
▷ Named functions375.00%
▷ Anonymous functions125.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
8 PNG files occupy 0.12MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon1.png1.99KB1.17KB▼ 41.23%
assets/images/ad_bg.png95.04KB103.00KB0.00%
assets/images/acovsw-icons.png17.06KB5.99KB▼ 64.87%
assets/images/link-go.png1.02KB0.24KB▼ 77.00%
assets/images/calendar-icon.png1.18KB0.33KB▼ 72.29%