10% moco-smart-search

Code Review | Smart Search for WooCommerce

WordPress plugin Smart Search for WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: moco-smart-search
  • Plugin version: 1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-4.8.1
  • WordPress version: 6.3.1
  • First release: Aug 5, 2017
  • Latest release: Aug 17, 2017
  • Number of updates: 4
  • Update frequency: every 3.0 days
  • Top authors: VolcomMky (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /769 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
These installer errors require your attention
  • Install procedure had errors
    • > Warning in wp-content/plugins/moco-smart-search/classes/MoCo_SmartSearch_Base.php+283
    "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Server metrics [RAM: ▼0.79MB] [CPU: ▼33.40ms] Passed 4 tests

Analyzing server-side resources used by Smart Search for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1247.62 ▲3.90
Dashboard /wp-admin3.16 ▼0.1830.49 ▼33.33
Posts /wp-admin/edit.php3.16 ▼0.1933.55 ▼17.25
Add New Post /wp-admin/post-new.php3.16 ▼2.7230.90 ▼74.41
Media Library /wp-admin/upload.php3.16 ▼0.0731.21 ▼8.62

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 35 new files
Database: no new tables, 17 new options
New WordPress options
mocoss_setup
mocoss_facets
mocoss_items
widget_recent-comments
widget_recent-posts
mocoss_key
mocoss_includes
mocoss_facet_ignores
widget_theysaidso_widget
db_upgraded
...

Browser metrics Passed 4 tests

A check of browser resources used by Smart Search for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,930 ▲15914.09 ▼0.298.32 ▲6.3048.64 ▲5.35
Dashboard /wp-admin2,220 ▲655.83 ▲0.13102.69 ▲1.2379.11 ▲38.04
Posts /wp-admin/edit.php2,097 ▲81.97 ▼0.0337.48 ▼0.1933.07 ▼8.10
Add New Post /wp-admin/post-new.php1,678 ▲15922.13 ▼1.33724.05 ▲43.4558.85 ▲3.50
Media Library /wp-admin/upload.php1,399 ▲114.12 ▼0.0398.11 ▼17.1163.64 ▲15.51

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Uninstall procedure validation failed for this plugin
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
  • This plugin did not uninstall successfully, leaving 17 options in the database
    • mocoss_key
    • widget_theysaidso_widget
    • mocoss_facets
    • theysaidso_admin_options
    • widget_recent-posts
    • mocoss_autocomplete
    • db_upgraded
    • widget_recent-comments
    • mocoss_enabled
    • mocoss_setup
    • ...

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
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
Please take a closer look at the following
  • 5× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/moco-smart-search/moco-smart-search.php
    • > /wp-content/plugins/moco-smart-search/templates/header.php
    • > /wp-content/plugins/moco-smart-search/templates/status.php
    • > /wp-content/plugins/moco-smart-search/templates/frontend/tpl.scripts.php
    • > /wp-content/plugins/moco-smart-search/templates/frontend/tpl.filters.php
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'MoCo_SmartBase' not found in wp-content/plugins/moco-smart-search/classes/class.autocomplete.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'MoCo_SmartSearch' not found in wp-content/plugins/moco-smart-search/classes/class.navigation.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'MoCo_SmartBase' not found in wp-content/plugins/moco-smart-search/classes/class.smartsearch.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'MCSmartSearch\\MoCo_SmartSearch_Base' not found in wp-content/plugins/moco-smart-search/classes/MoCo_SmartSearch.php:4
    • > PHP Notice
      Undefined variable: SmartSearchWP_Admin in wp-content/plugins/moco-smart-search/templates/content.php on line 2
    • > PHP Notice
      Undefined index: facets in wp-content/plugins/moco-smart-search/templates/frontend/tpl.filters.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to a member function assets() on null in wp-content/plugins/moco-smart-search/templates/content.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (Setup Process), #2 (SmartSearch Statistics), #3 (SmartSearch WP Settings)
The official readme.txt is a good inspiration

moco-smart-search/moco-smart-search.php 92% from 13 tests

The principal PHP file in "Smart Search for WooCommerce" v. 1.4 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Description: Please keep the plugin description shorter than 140 characters (currently 179 characters long)

Code Analysis Passed 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
No dangerous file extensions were detected22,904 lines of code in 28 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript53,88710,10813,739
CSS552367,145
PHP182974112,020

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity18.94
▷ Minimum class complexity1.00
▷ Maximum class complexity64.00
Average method complexity3.70
▷ Minimum method complexity1.00
▷ Maximum method complexity39.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes16
▷ Abstract classes00.00%
▷ Concrete classes16100.00%
▷ Final classes00.00%
Methods91
▷ Static methods1415.38%
▷ Public methods7076.92%
▷ Protected methods1010.99%
▷ Private methods1112.09%
Functions5
▷ Named functions360.00%
▷ Anonymous functions240.00%
Constants2
▷ Global constants00.00%
▷ Class constants2100.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
6 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/gs-assets/img/sort_desc.png1.10KB0.25KB▼ 77.73%
assets/gs-assets/img/sort_both.png1.11KB0.29KB▼ 74.12%
assets/logox30.png1.25KB1.55KB0.00%
assets/logo.png0.63KB0.87KB0.00%
assets/ss-logo-full.png4.47KB3.08KB▼ 31.12%