78% woocommerce-product-sort-and-display

Code Review | Product Sort and Display for WooCommerce

WordPress plugin Product Sort and Display for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: woocommerce-produ...
  • Plugin version: 2.4.1
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Aug 1, 2013
  • Latest release: Nov 23, 2023
  • Number of updates: 178
  • Update frequency: every 21.2 days
  • Top authors: a3rev (100%)

Code review

54 tests

User reviews

45 reviews

Install metrics

3,000+ active /303,011 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲2.57MB] [CPU: ▲9.90ms] Passed 4 tests

A check of server-side resources used by Product Sort and Display for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /6.03 ▲2.5752.83 ▲12.05
Dashboard /wp-admin5.85 ▲2.5560.49 ▲8.70
Posts /wp-admin/edit.php5.97 ▲2.6160.79 ▲4.16
Add New Post /wp-admin/post-new.php8.52 ▲2.63108.87 ▲18.70
Media Library /wp-admin/upload.php5.78 ▲2.5450.89 ▲14.69
Sort & Display /wp-admin/admin.php?page=wc-sort-display5.8664.32

Server storage [IO: ▲2.45MB] [DB: ▲0.07MB] Passed 3 tests

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 151 new files
Database: no new tables, 145 new options
New WordPress options
psad_es_category_item_link_align
widget_recent-posts
psad_es_products_bt_shadow
wc_psad_clean_on_deletion
psad_count_meta_padding_top
psad_shop_product_per_page
psad_es_products_bt_padding_lr
psad_es_top_products_bt_bg_to
psad_top_product_per_page
psad_es_category_link_margin_bottom
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Product Sort and Display for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,794 ▲714.27 ▼0.121.58 ▼0.3836.84 ▼7.50
Dashboard /wp-admin2,197 ▲195.58 ▼0.14101.52 ▼11.9342.48 ▼3.83
Posts /wp-admin/edit.php2,102 ▼11.94 ▼0.0340.15 ▲1.9335.79 ▼0.43
Add New Post /wp-admin/post-new.php1,528 ▼323.18 ▲0.38615.08 ▼2.2956.69 ▲8.77
Media Library /wp-admin/upload.php1,402 ▼14.24 ▲0.0596.52 ▼0.1543.22 ▼2.49
Sort & Display /wp-admin/admin.php?page=wc-sort-display3,1014.74117.34109.14

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 144 options
    • psad_es_shop_link_font_hover_color
    • psad_es_category_bt_margin_bottom
    • psad_es_shop_bt_font
    • psad_es_shop_bt_margin_top
    • psad_es_category_item_link_font_hover_color
    • psad_es_products_bt_margin_bottom
    • psad_es_products_bt_align
    • psad_es_products_bt_type
    • psad_es_category_link_margin_bottom
    • psad_es_category_bt_font
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/woocommerce-product-sort-and-display/templates/customized_style.php
  • 3× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woocommerce-product-sort-and-display/admin/wc-psad-init.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/woocommerce-product-sort-and-display/wc-psad.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/woocommerce-product-sort-and-display/templates/customized_style.php:109

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 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
5 plugin tags: woocommerce product sort, woocommerce, woocommerce product display, woocommerce shop page, woocommerce products

woocommerce-product-sort-and-display/wc-psad.php 85% from 13 tests

Analyzing the main PHP file in "Product Sort and Display for WooCommerce" version 2.4.1
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("woocommerce-product-sort-and-display.php" instead of "wc-psad.php")
  • Description: Please keep the plugin description shorter than 140 characters (currently 285 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected42,325 lines of code in 94 files:
LanguageFilesBlank linesComment linesLines of code
JSON10013,203
JavaScript312,1491,64912,887
PHP302,4352,19711,651
CSS223151543,395
LESS57526642
PO File1194274471
SVG33047
HTML12029

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Please fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 410)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity78.58
▷ Minimum class complexity1.00
▷ Maximum class complexity801.00
Average method complexity5.80
▷ Minimum method complexity1.00
▷ Maximum method complexity410.00
Code structure
Namespaces7
Interfaces0
Traits0
Classes26
▷ Abstract classes00.00%
▷ Concrete classes26100.00%
▷ Final classes00.00%
Methods421
▷ Static methods235.46%
▷ Public methods25259.86%
▷ Protected methods14133.49%
▷ Private methods286.65%
Functions14
▷ Named functions1285.71%
▷ Anonymous functions214.29%
Constants20
▷ Global constants1575.00%
▷ Class constants525.00%
▷ Public constants5100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
33 PNG files occupy 0.16MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/includes/uploader/delete.png0.13KB0.13KB0.00%
admin/assets/images/help.png0.30KB0.32KB0.00%
admin/assets/images/slider-handle.png2.67KB1.71KB▼ 36.00%
admin/assets/images/slider-bg-range.png1.06KB0.14KB▼ 86.65%
admin/assets/images/ico-delete.png0.13KB0.13KB0.00%