Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Spellchecker.php

Summary

Maintainability
C
1 day
Test Coverage

Function extractTermStatsByPosition has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    private function extractTermStatsByPosition($termVectors, $useAllTokens = false)
    {
        $statByPosition = [];
        $analyzers      = [
            FieldInterface::ANALYZER_STANDARD,

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function parseTermVectors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function parseTermVectors($termVectors, $cutoffFrequencyLimit, $useAllTokens = false)
    {
        $queryTermStats = ['stop' => 0, 'exact' => 0, 'standard' => 0, 'missing' => 0];
        $statByPosition = $this->extractTermStatsByPosition($termVectors, $useAllTokens);

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Argument 1 (indexName) is array{index:string} but \Smile\ElasticsuiteCore\Api\Client\ClientInterface::indexStats() takes string defined at /code/src/module-elasticsuite-core/Api/Client/ClientInterface.php:185
Open

            $this->indexStatsCache[$indexName] = $this->client->indexStats(['index' => $indexName]);

There are no issues that match your filters.

Category
Status