67% swiftype-search

Code Review | Swiftype Site Search Plugin for Wordpress

WordPress plugin Swiftype Site Search Plugin for Wordpress scored67%from 54 tests.

About plugin

  • Plugin page: swiftype-search
  • Plugin version: 2.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-5.8.1
  • WordPress version: 6.3.1
  • First release: Jun 27, 2012
  • Latest release: Sep 15, 2021
  • Number of updates: 252
  • Update frequency: every 13.4 days
  • Top authors: matthewtyriley (59.92%)qhoxie (15.48%)afoucret (10.71%)lukefrancl (7.94%)jblasius (4.37%)

Code review

54 tests

User reviews

24 reviews

Install metrics

1,000+ active /131,364 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼1.54ms] Passed 4 tests

Server-side resources used by Swiftype Site Search Plugin for Wordpress
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0536.63 ▲0.56
Dashboard /wp-admin3.36 ▲0.0647.67 ▲1.24
Posts /wp-admin/edit.php3.47 ▲0.1245.56 ▼5.84
Add New Post /wp-admin/post-new.php5.94 ▲0.0683.19 ▲1.92
Media Library /wp-admin/upload.php3.28 ▲0.0633.20 ▼2.13

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 1,167 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
theysaidso_admin_options
widget_swiftype_search_widget
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Swiftype Site Search Plugin for Wordpress
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,817 ▲4614.73 ▲0.151.69 ▼0.1743.91 ▲1.60
Dashboard /wp-admin2,224 ▲365.88 ▼0.0194.20 ▼5.5689.80 ▲48.03
Posts /wp-admin/edit.php2,107 ▲182.01 ▼0.0133.55 ▼6.9235.16 ▼0.67
Add New Post /wp-admin/post-new.php1,681 ▲13922.44 ▲4.22651.25 ▲54.8458.73 ▲7.50
Media Library /wp-admin/upload.php1,400 ▲124.13 ▼0.07110.13 ▲12.6044.30 ▲1.01

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • widget_swiftype_search_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for 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
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/swiftype-search/Tests/bootstrap.php
    • > /wp-content/plugins/swiftype-search/templates/admin/common/header.php
  • 172× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/swiftype-search/vendor/elastic/site-search/Tests/Unit/Connection/Handler/RequestClientHeaderHandlerTest.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'React\\Promise\\PromiseInterface' not found in wp-content/plugins/swiftype-search/vendor/guzzlehttp/ringphp/src/Future/FutureInterface.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'React\\Promise\\TestCase' not found in wp-content/plugins/swiftype-search/vendor/react/promise/tests/FunctionResolveTest.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Elastic\\OpenApi\\Codegen\\Exception\\ApiException' not found in wp-content/plugins/swiftype-search/vendor/elastic/openapi-codegen/Exception/AuthenticationException.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/swiftype-search/Tests/AbstractTestCase.php:8
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/swiftype-search/templates/admin/controls/search-settings.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Elastic\\OpenApi\\Codegen\\Endpoint\\AbstractEndpoint' not found in wp-content/plugins/swiftype-search/vendor/elastic/site-search/Endpoint/ListDocuments.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CLI_Command' not found in wp-content/plugins/swiftype-search/Cli/Command.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Elastic\\OpenApi\\Codegen\\Exception\\ClientException' not found in wp-content/plugins/swiftype-search/vendor/elastic/openapi-codegen/Exception/JsonErrorException.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Elastic\\OpenApi\\Codegen\\Endpoint\\AbstractEndpoint' not found in wp-content/plugins/swiftype-search/vendor/elastic/site-search/Endpoint/GetTopQueriesAnalyticsEngine.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Donate link: Invalid URI found ("")
The official readme.txt is a good inspiration

swiftype-search/swiftype.php 85% from 13 tests

The main PHP file in "Swiftype Site Search Plugin for Wordpress" ver. 2.0.5 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Description: The description should be shorter than 140 characters (currently 256 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("swiftype-search.php" instead of "swiftype.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
These items require your attention
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .cmd - Command Script in Windows
      • wp-content/plugins/swiftype-search/node_modules/grunt/test/fixtures/exec.cmd
138,226 lines of code in 911 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript44318,99532,563101,131
PHP2483,4755,59315,750
Markdown664,586011,032
HTML939982,865
JSON55002,842
YAML22192411,481
CSS518127778
XML14180697
reStructuredText9263333517
Bourne Shell85823279
Mustache16740247
make4485190
Maven171121
Ruby3192108
Java1250100
Dockerfile321744
Python14019
CoffeeScript17813
Bourne Again Shell13011
DOS Batch1001

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.14
Average class complexity4.32
▷ Minimum class complexity1.00
▷ Maximum class complexity89.00
Average method complexity1.60
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces41
Interfaces15
Traits14
Classes203
▷ Abstract classes52.46%
▷ Concrete classes19897.54%
▷ Final classes10.51%
Methods1,303
▷ Static methods584.45%
▷ Public methods1,17089.79%
▷ Protected methods292.23%
▷ Private methods1047.98%
Functions310
▷ Named functions185.81%
▷ Anonymous functions29294.19%
Constants35
▷ Global constants12.86%
▷ Class constants3497.14%
▷ Public constants34100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
10 PNG files occupy 1.36MB with 0.74MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png172.01KB48.05KB▼ 72.06%
node_modules/grunt/test/fixtures/octocat.png3.89KB2.53KB▼ 34.91%
assets/screenshot-2.png169.55KB47.43KB▼ 72.02%
assets/banner-1544x500.png551.32KB183.23KB▼ 66.76%
assets/swiftype_logo_menu.png1.13KB0.82KB▼ 27.70%