10% predictive-search

Code Review | Predictive Search

WordPress plugin Predictive Search scored10%from 54 tests.

About plugin

  • Plugin page: predictive-search
  • Plugin version: 1.2.6
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Aug 5, 2022
  • Latest release: Nov 23, 2023
  • Number of updates: 26
  • Update frequency: every 18.3 days
  • Top authors: a3rev (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /1,958 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Please fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Notice in wp-includes/class-wpdb.php+789
    Undefined property: wpdb::$ps_exclude

Server metrics [RAM: ▲4.73MB] [CPU: ▲26.63ms] Passed 4 tests

An overview of server-side resources used by Predictive Search
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /8.19 ▲4.7268.63 ▲26.82
Dashboard /wp-admin8.05 ▲4.7075.07 ▲10.89
Posts /wp-admin/edit.php8.11 ▲4.7582.64 ▲37.27
Add New Post /wp-admin/post-new.php10.78 ▲4.89129.19 ▲31.54
Media Library /wp-admin/upload.php7.98 ▲4.7570.78 ▲38.98

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 373 new files
Database: 6 new tables, 59 new options
New tables
wp_ps_postmeta
wp_ps_posts
wp_ps_keyword
wp_ps_taxonomy
wp_ps_exclude
wp_ps_term_relationships
New WordPress options
theysaidso_admin_options
predictive_search_mode
widget_recent-comments
wpps_search_character_max
wpps_search_focus_plugin
wpps_search_enable_google_analytic
predictive_search_rebuild_cat_cache
wpps_search_replace_special_character
wpps_search_post_items
wpps_search_google_analytic_id
...

Browser metrics Passed 4 tests

A check of browser resources used by Predictive Search
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,959 ▲18713.88 ▼0.5112.33 ▲10.3637.00 ▼6.45
Dashboard /wp-admin2,229 ▲495.61 ▲0.0195.56 ▼0.5044.49 ▼1.57
Posts /wp-admin/edit.php2,269 ▲1692.13 ▲0.1741.95 ▲2.3635.43 ▲2.31
Add New Post /wp-admin/post-new.php2,043 ▲51729.22 ▲6.28717.39 ▲91.3462.66 ▲13.71
Media Library /wp-admin/upload.php1,431 ▲314.24 ▲0.0394.72 ▼13.3847.14 ▲5.93

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • The plugin did not uninstall successfully, leaving 6 tables in the database
    • wp_ps_posts
    • wp_ps_term_relationships
    • wp_ps_taxonomy
    • wp_ps_exclude
    • wp_ps_postmeta
    • wp_ps_keyword
  • This plugin did not uninstall successfully, leaving 58 options in the database
    • wpps_search_exclude_post
    • wpps_search_focus_plugin
    • theysaidso_admin_options
    • wpps_search_schedule_error_recipients
    • wpps_search_show_desc
    • db_upgraded
    • wp_predictive_search_input_box_settings
    • widget_wp_predictive_search
    • wpps_all_results_pages_settings
    • wpps_search_remove_special_character
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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
The following issues need your attention
  • 23× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/predictive-search/src/blocks/query-results/block.php:63
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/predictive-search/src/blocks/item-template/block.php:68
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/predictive-search/src/blocks/item-title/block.php:81
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/predictive-search/src/blocks/item-excerpt/block.php:85
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/predictive-search/wp-predictive-search.php:27
    • > PHP Warning
      extract() expects parameter 1 to be array, null given in wp-content/plugins/predictive-search/templates/dynamic-styles/results-style.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/predictive-search/src/blocks/item-featured-image/block.php:94
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/predictive-search/src/patterns/pattern-1.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/predictive-search/templates/dynamic-styles/results-style.php:13
    • > PHP Warning
      Division by zero in wp-content/plugins/predictive-search/templates/dynamic-styles/results-style.php on line 10

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 issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
4 plugin tags: live search, wordpress search, elementor search, predictive search

predictive-search/wp-predictive-search.php 77% from 13 tests

The main PHP file in "Predictive Search" ver. 1.2.6 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 210 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("predictive-search.php" instead of "wp-predictive-search.php")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin68,592 lines of code in 305 files:
LanguageFilesBlank linesComment linesLines of code
PHP974,9104,19320,999
JavaScript1263,2002,43120,203
JSON120013,772
CSS248431886,378
PO File52,4414,4726,142
LESS57526642
Sass13472325
SVG183062
HTML372243
XML25326

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 410)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity48.26
▷ Minimum class complexity1.00
▷ Maximum class complexity801.00
Average method complexity5.12
▷ Minimum method complexity1.00
▷ Maximum method complexity410.00
Code structure
Namespaces12
Interfaces0
Traits0
Classes70
▷ Abstract classes00.00%
▷ Concrete classes70100.00%
▷ Final classes00.00%
Methods801
▷ Static methods728.99%
▷ Public methods63078.65%
▷ Protected methods14317.85%
▷ Private methods283.50%
Functions76
▷ Named functions6585.53%
▷ Anonymous functions1114.47%
Constants23
▷ Global constants1565.22%
▷ Class constants834.78%
▷ Public constants8100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
36 PNG files occupy 0.23MB with 0.10MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/placeholder.png10.99KB5.61KB▼ 48.95%
admin/assets/images/ico-delete.png0.13KB0.13KB0.00%
admin/assets/images/slider-container-start-disable.png1.53KB0.56KB▼ 63.40%
admin/assets/images/slider-handle.png2.67KB1.71KB▼ 36.00%
admin/assets/images/ico-preview.png1.11KB0.36KB▼ 67.28%