67% wp-simple-elasticsearch

Code Review | WP Simple Elasticsearch

WordPress plugin WP Simple Elasticsearch scored67%from 54 tests.

About plugin

  • Plugin page: wp-simple-elastic...
  • Plugin version: 0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-4.5.2
  • WordPress version: 6.3.1
  • First release: Jun 5, 2016
  • Latest release: Jun 5, 2016
  • Number of updates: 11
  • Update frequency: every 0.3 days
  • Top authors: horike (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,469 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.19MB] [CPU: ▲3.11ms] Passed 4 tests

Server-side resources used by WP Simple Elasticsearch
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1844.86 ▼0.53
Dashboard /wp-admin3.49 ▲0.1958.74 ▼0.88
Posts /wp-admin/edit.php3.61 ▲0.2555.51 ▲6.64
Add New Post /wp-admin/post-new.php6.07 ▲0.19100.41 ▲11.59
Media Library /wp-admin/upload.php3.41 ▲0.1941.51 ▲7.21
WP Simple Elasticsearch /wp-admin/options-general.php?page=wp_elasticsearch3.3837.07

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 998 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for WP Simple Elasticsearch
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,796 ▲3514.27 ▼0.091.49 ▼0.4442.77 ▼5.25
Dashboard /wp-admin2,199 ▲225.67 ▲0.1494.26 ▲2.1943.24 ▲2.57
Posts /wp-admin/edit.php2,107 ▲72.00 ▲0.0242.94 ▲2.6636.20 ▼10.48
Add New Post /wp-admin/post-new.php1,543 ▲417.88 ▼0.19608.50 ▼25.1263.71 ▲3.32
Media Library /wp-admin/upload.php1,401 ▼24.23 ▲0.0498.40 ▼6.3445.13 ▲2.44
WP Simple Elasticsearch /wp-admin/options-general.php?page=wp_elasticsearch9642.2923.7132.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
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
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
Almost there! Just fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/wp-simple-elasticsearch/vendor/squizlabs/php_codesniffer/scripts/build-phar.php
  • 706× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Test\\Aggregation\\BaseAggregationTest' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/test/lib/Elastica/Test/Aggregation/HistogramTest.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Bulk\\Action\\AbstractDocument' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Bulk/Action/DeleteDocument.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Filter\\AbstractFilter' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Filter/Nested.php:17
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/test/bootstrap.php on line 5
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Filter\\AbstractFilter' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Filter/Regexp.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractSniffUnitTest' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/wp-coding-standards/wpcs/WordPress/Tests/NamingConventions/ValidFunctionNameUnitTest.php:31
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Query\\AbstractQuery' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Query/Common.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Elastica\\Exception\\ExceptionInterface' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Exception/InvalidException.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Test\\Base' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/BuilderTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Test\\DeprecatedClassBase' not found in wp-content/plugins/wp-simple-elasticsearch/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/BoolOrTest.php:10

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 83% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Add an image for screenshot #1 (Setting Screen)
The official readme.txt might help

wp-simple-elasticsearch/wp-elasticsearch.php 69% from 13 tests

This is the main PHP file of "WP Simple Elasticsearch" version 0.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Git Repository: Please remove the Git repository from this plugin
  • Domain Path: The domain path is invalid: folder "/languages" does not exist
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wp-simple-elasticsearch.php" instead of "wp-elasticsearch.php")

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
These items require your attention
  • Do not include executable or dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/wp-simple-elasticsearch/vendor/squizlabs/php_codesniffer/scripts/phpcbf.bat
      • wp-content/plugins/wp-simple-elasticsearch/vendor/squizlabs/php_codesniffer/scripts/phpcs.bat
69,260 lines of code in 941 files:
LanguageFilesBlank linesComment linesLines of code
PHP77216,32736,16362,657
XML1231571953,960
Markdown1251401,425
Pascal12248316457
JSON610394
YAML63327135
make13622125
Dockerfile4201843
Bourne Shell18937
DOS Batch222216
Bourne Again Shell14010
Groovy1001

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 247)
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity10.29
▷ Minimum class complexity1.00
▷ Maximum class complexity519.00
Average method complexity3.08
▷ Minimum method complexity1.00
▷ Maximum method complexity247.00
Code structure
Namespaces55
Interfaces12
Traits2
Classes749
▷ Abstract classes293.87%
▷ Concrete classes72096.13%
▷ Final classes10.14%
Methods3,455
▷ Static methods722.08%
▷ Public methods3,12490.42%
▷ Protected methods2798.08%
▷ Private methods521.51%
Functions31
▷ Named functions1754.84%
▷ Anonymous functions1445.16%
Constants267
▷ Global constants9334.83%
▷ Class constants17465.17%
▷ Public constants174100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.12MB with 0.09MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png122.18KB34.66KB▼ 71.63%