84% wp-algolia

Code Review | Algolia for WordPress

WordPress plugin Algolia for WordPress scored84%from 54 tests.

About plugin

  • Plugin page: wp-algolia
  • Plugin version: 3.1.2
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.8
  • WordPress version: 6.3.1
  • First release: Jun 4, 2019
  • Latest release: Jul 25, 2022
  • Number of updates: 14
  • Update frequency: every 81.9 days
  • Top authors: leocolomb (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /2,808 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: ▲0.35MB] [CPU: ▲2.58ms] Passed 4 tests

A check of server-side resources used by Algolia for WordPress
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.80 ▲0.3441.07 ▲5.09
Dashboard /wp-admin3.69 ▲0.3947.31 ▼1.79
Posts /wp-admin/edit.php3.74 ▲0.3948.73 ▲3.42
Add New Post /wp-admin/post-new.php6.23 ▲0.3489.91 ▲3.60
Media Library /wp-admin/upload.php3.55 ▲0.3237.15 ▲5.74
Algolia /wp-admin/options-general.php?page=algolia3.5232.92

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 253 new files
Database: no new tables, 13 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
algolia_synced_indices_ids
algolia_override_native_search
algolia_api_is_reachable
algolia_api_key
db_upgraded
algolia_search_api_key
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

Algolia for WordPress: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲7113.28 ▼1.094.58 ▲2.9942.10 ▲0.82
Dashboard /wp-admin2,212 ▲244.89 ▼1.02104.26 ▲0.8138.74 ▼6.69
Posts /wp-admin/edit.php2,098 ▲92.04 ▼0.0839.60 ▼2.7635.07 ▼1.26
Add New Post /wp-admin/post-new.php1,536 ▼623.26 ▲5.29676.47 ▲46.6453.79 ▲3.48
Media Library /wp-admin/upload.php1,391 ▲64.21 ▲0.0197.90 ▼4.7641.14 ▼2.86
Algolia /wp-admin/options-general.php?page=algolia8782.0722.8927.29

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 13 options
    • algolia_api_key
    • widget_recent-posts
    • widget_theysaidso_widget
    • algolia_search_api_key
    • algolia_application_id
    • can_compress_scripts
    • algolia_api_is_reachable
    • algolia_index_name_prefix
    • db_upgraded
    • theysaidso_admin_options
    • ...

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
Good news, no errors were detected

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 take a closer look at the following
  • 103× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wp-algolia/vendor/guzzlehttp/psr7/src/Stream.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CLI_Command' not found in wp-content/plugins/wp-algolia/src/class-algolia-cli.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wp-algolia/vendor/guzzlehttp/psr7/src/BufferStream.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/wp-algolia/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/wp-algolia/vendor/guzzlehttp/guzzle/src/Pool.php:24
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/wp-algolia/vendor/psr/http-message/src/ResponseInterface.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Algolia\\AlgoliaSearch\\Response\\AbstractResponse' not found in wp-content/plugins/wp-algolia/vendor/algolia/algoliasearch-client-php/src/Response/RestoreApiKeyResponse.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/wp-algolia/vendor/guzzlehttp/promises/src/EachPromise.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Algolia\\AlgoliaSearch\\Http\\HttpClientInterface' not found in wp-content/plugins/wp-algolia/vendor/algolia/algoliasearch-client-php/src/Http/CurlHttpClient.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wp-algolia/vendor/guzzlehttp/psr7/src/InflateStream.php:20

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: search, relevant search, better search, algolia, custom search

wp-algolia/wp-algolia.php Passed 13 tests

The principal PHP file in "Algolia for WordPress" v. 3.1.2 is loaded by WordPress automatically on each request
66 characters long description:
A (unofficial) WordPress plugin to use Algolia as a search engine.

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
There were no executable files found in this plugin19,320 lines of code in 232 files:
LanguageFilesBlank linesComment linesLines of code
PHP2223,8828,95717,256
Markdown324701,030
JSON100793
YAML21814131
JavaScript116075
XML18614
Dockerfile14212
make1409

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity10.59
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity2.35
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces26
Interfaces34
Traits5
Classes168
▷ Abstract classes74.17%
▷ Concrete classes16195.83%
▷ Final classes8653.42%
Methods1,485
▷ Static methods21114.21%
▷ Public methods1,25384.38%
▷ Protected methods634.24%
▷ Private methods16911.38%
Functions152
▷ Named functions3724.34%
▷ Anonymous functions11575.66%
Constants81
▷ Global constants11.23%
▷ Class constants8098.77%
▷ Public constants6986.25%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.54MB with 0.34MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
.wordpress-org/banner-1544x500.png304.90KB66.00KB▼ 78.35%
.wordpress-org/banner-772x250.png90.15KB22.05KB▼ 75.54%
.wordpress-org/icon-128x128.png17.04KB8.35KB▼ 51.01%
.wordpress-org/screenshot-1.png78.05KB44.21KB▼ 43.36%
.wordpress-org/icon-256x256.png59.78KB20.49KB▼ 65.73%