74% woocommerce-predictive-search

Code Review | Predictive Search for WooCommerce

WordPress plugin Predictive Search for WooCommerce scored74%from 54 tests.

About plugin

  • Plugin page: woocommerce-predi...
  • Plugin version: 5.8.4
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.4
  • WordPress version: 6.3.1
  • First release: Aug 1, 2012
  • Latest release: Nov 23, 2023
  • Number of updates: 284
  • Update frequency: every 14.6 days
  • Top authors: a3rev (100%)

Code review

54 tests

User reviews

49 reviews

Install metrics

1,000+ active /262,226 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲3.60MB] [CPU: ▲19.03ms] Passed 4 tests

An overview of server-side resources used by Predictive Search for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /6.97 ▲3.5053.05 ▲17.47
Dashboard /wp-admin6.94 ▲3.6370.81 ▲19.91
Posts /wp-admin/edit.php6.99 ▲3.6365.51 ▲15.64
Add New Post /wp-admin/post-new.php9.63 ▲3.74110.27 ▲23.08
Media Library /wp-admin/upload.php6.86 ▲3.6358.69 ▲26.77
Predictive Search /wp-admin/admin.php?page=woo-predictive-search6.9779.30

Server storage [IO: ▲2.98MB] [DB: ▲0.08MB] Passed 3 tests

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 199 new files
Database: 4 new tables, 38 new options
New tables
wp_ps_product_sku
wp_ps_exclude
wp_ps_postmeta
wp_ps_posts
New WordPress options
wc_predictive_search_sidebar_template_settings
woocommerce_search_allow_auto_sync_data
woocommerce_search_price_enable
wc_predictive_search_input_box_settings
woocommerce_search_sku_enable
can_compress_scripts
woocommerce_search_text_lenght
db_upgraded
widget_recent-posts
woocommerce_search_is_debug
...

Browser metrics Passed 4 tests

Predictive Search for WooCommerce: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,483 ▼27914.63 ▲0.360.54 ▼1.0718.84 ▼20.82
Dashboard /wp-admin2,212 ▲375.62 ▼0.0996.75 ▼15.5843.64 ▼2.79
Posts /wp-admin/edit.php2,118 ▲182.12 ▲0.1742.03 ▲2.4235.55 ▼0.51
Add New Post /wp-admin/post-new.php1,815 ▲28925.07 ▲2.01620.13 ▼29.9776.64 ▲21.85
Media Library /wp-admin/upload.php1,420 ▲204.18 ▲0.0496.42 ▼2.3044.37 ▲1.12
Predictive Search /wp-admin/admin.php?page=woo-predictive-search2,7154.34108.60106.86

Uninstaller [IO: ▲0.05MB] [DB: ▲0.02MB] 50% 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
  • This plugin does not fully uninstall, leaving 4 tables in the database
    • wp_ps_exclude
    • wp_ps_posts
    • wp_ps_product_sku
    • wp_ps_postmeta
  • This plugin does not fully uninstall, leaving 37 options in the database
    • woocommerce_search_result_grid_container_class
    • woocommerce_search_result_items
    • widget_recent-comments
    • woocommerce_search_exclude_products
    • woocommerce_search_exclude_pages
    • woocommerce_search_schedule_time_sync_data
    • db_upgraded
    • woocommerce_search_replace_special_character
    • woocommerce_search_addtocart_enable
    • woocommerce_search_exclude_out_stock
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 54× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: sidebar_search_box_align in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/sidebar-template-style.php on line 15
    • > PHP Notice
      Undefined variable: header_search_box_wide in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/header-template-style.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woocommerce-predictive-search/admin/wc-predictive-search-init.php:44
    • > PHP Notice
      Undefined variable: sidebar_search_box_border in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/sidebar-template-style.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to a member function generate_border_css() on null in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/header-template-style.php:22
    • > PHP Notice
      Undefined variable: header_search_box_mobile_margin_right in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/header-template-style.php on line 9
    • > PHP Warning
      Use of undefined constant WOOPS_PREFIX - assumed 'WOOPS_PREFIX' (this will throw an Error in a future version of PHP) in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/header-template-style.php on line 22
    • > PHP Notice
      Undefined variable: sidebar_search_box_mobile_margin_bottom in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/sidebar-template-style.php on line 12
    • > PHP Notice
      Undefined variable: sidebar_search_box_border in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/sidebar-template-style.php on line 9
    • > PHP Notice
      Undefined variable: header_search_box_mobile_margin_top in wp-content/plugins/woocommerce-predictive-search/templates/dynamic-styles/header-template-style.php on line 12

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
5 plugin tags: elementor woocommerce search, woocommerce, live search, woocommerce search, predictive search

woocommerce-predictive-search/wc-predictive-search.php 92% from 13 tests

"Predictive Search for WooCommerce" version 5.8.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("woocommerce-predictive-search.php" instead of "wc-predictive-search.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected50,851 lines of code in 133 files:
LanguageFilesBlank linesComment linesLines of code
PHP673,6303,09715,611
JavaScript302,1241,56813,215
JSON10013,203
PO File52,0283,6514,569
CSS213111603,535
LESS57526642
SVG33047
HTML12029

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 410)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity56.09
▷ Minimum class complexity1.00
▷ Maximum class complexity801.00
Average method complexity5.35
▷ Minimum method complexity1.00
▷ Maximum method complexity410.00
Code structure
Namespaces8
Interfaces0
Traits0
Classes46
▷ Abstract classes00.00%
▷ Concrete classes46100.00%
▷ Final classes00.00%
Methods583
▷ Static methods478.06%
▷ Public methods41471.01%
▷ Protected methods14124.19%
▷ Private methods284.80%
Functions38
▷ Named functions3694.74%
▷ Anonymous functions25.26%
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.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/free-wordpress-plugins.png79.93KB29.22KB▼ 63.44%
admin/assets/images/slider-bg-track1.png1.10KB0.61KB▼ 44.28%
assets/images/key.png0.60KB0.59KB▼ 1.47%
admin/assets/images/slider-container-end.png1.83KB0.71KB▼ 61.18%
assets/images/follow-facebook.png1.56KB0.43KB▼ 72.77%