88% woo-product-attachment

Code Review | Product Attachment for WooCommerce

WordPress plugin Product Attachment for WooCommerce scored88%from 54 tests.

About plugin

  • Plugin page: woo-product-attac...
  • Plugin version: 2.2.1
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Jul 13, 2017
  • Latest release: Sep 15, 2023
  • Number of updates: 190
  • Update frequency: every 11.9 days
  • Top authors: dots (100%)

Code review

54 tests

User reviews

20 reviews

Install metrics

6,000+ active /124,706 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.00MB] [CPU: ▼7.21ms] Passed 4 tests

Analyzing server-side resources used by Product Attachment for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.51 ▲0.03
Dashboard /wp-admin3.31 ▼0.0346.29 ▼15.78
Posts /wp-admin/edit.php3.36 ▲0.0145.57 ▲1.41
Add New Post /wp-admin/post-new.php5.89 ▲0.0178.30 ▼14.15
Media Library /wp-admin/upload.php3.24 ▲0.0133.44 ▲1.06

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 282 new files
Database: no new tables, 22 new options
New WordPress options
theysaidso_admin_options
wcpoa_admin_order_tab_name
wcpoa_att_download_btn
fs_debug_mode
widget_recent-comments
wcpoa_att_in_my_acc
can_compress_scripts
wcpoa_att_btn_in_order_list
wcpoa_product_download_type
wcpoa_att_in_thankyou
...

Browser metrics Passed 4 tests

Product Attachment for WooCommerce: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.39 ▼0.984.42 ▲2.6342.78 ▼1.94
Dashboard /wp-admin2,203 ▲185.80 ▼0.10100.70 ▼5.1740.80 ▲0.97
Posts /wp-admin/edit.php2,089 ▼01.99 ▲0.0333.98 ▼1.0432.92 ▼3.41
Add New Post /wp-admin/post-new.php1,542 ▲2823.33 ▲5.74657.83 ▼25.6463.13 ▲8.78
Media Library /wp-admin/upload.php1,382 ▼94.23 ▲0.0596.34 ▼5.7842.54 ▼3.85

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 22 options in the database
    • wcpoa_att_btn_in_order_list
    • db_upgraded
    • fs_debug_mode
    • widget_theysaidso_widget
    • wcpoa_att_download_btn
    • wcpoa_product_download_type
    • wcpoa_product_tab_name
    • fs_active_plugins
    • widget_recent-comments
    • wcpoa_att_btn_position
    • ...

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP Passed 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
Looking good! No server-side errors or output on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 86% 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
Attributes that need to be fixed: The official readme.txt might help

woo-product-attachment/woocommerce-product-attachment.php 77% from 13 tests

This is the main PHP file of "Product Attachment for WooCommerce" version 2.2.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("woo-product-attachment.php" instead of "woocommerce-product-attachment.php")
  • Description: Please keep the plugin description shorter than 140 characters (currently 193 characters long)

Code Analysis 95% 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
Success! There were no dangerous files found in this plugin48,567 lines of code in 177 files:
LanguageFilesBlank linesComment linesLines of code
PHP1378,67218,24841,410
PO File51,7354,5334,577
CSS23771031,392
JavaScript9871221,165
XML13016
SVG2007

PHP code 0% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
It is recommended to fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 3,088)
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 104)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity93.93
▷ Minimum class complexity1.00
▷ Maximum class complexity3,088.00
Average method complexity4.82
▷ Minimum method complexity1.00
▷ Maximum method complexity104.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes54
▷ Abstract classes23.70%
▷ Concrete classes5296.30%
▷ Final classes00.00%
Methods1,341
▷ Static methods20014.91%
▷ Public methods94570.47%
▷ Protected methods171.27%
▷ Private methods37928.26%
Functions113
▷ Named functions11198.23%
▷ Anonymous functions21.77%
Constants151
▷ Global constants10468.87%
▷ Class constants4731.13%
▷ Public constants47100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
45 PNG files occupy 4.79MB with 2.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/images/doc.png1.80KB0.81KB▼ 54.70%
admin/images/pro-features-img/feature-box-four-img.png173.99KB65.05KB▼ 62.61%
public/images/csv.png3.54KB1.91KB▼ 46.01%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
admin/images/attachment-default-icons/attachment_icon_4.png1.21KB1.42KB0.00%