Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-core/Index/Mapping/Field.php

Summary

Maintainability
C
7 hrs
Test Coverage

Field has 26 functions (exceeds 10 allowed). Consider refactoring.
Open

class Field implements FieldInterface
{
    /**
     * @var int
     */
Severity: Minor
Found in src/module-elasticsuite-core/Index/Mapping/Field.php - About 4 hrs to fix

    Function getPropertyConfig has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getPropertyConfig($analyzer = self::ANALYZER_UNTOUCHED): array
        {
            $fieldMapping = ['type' => $this->getType()];
    
            switch ($this->getType()) {
    Severity: Minor
    Found in src/module-elasticsuite-core/Index/Mapping/Field.php - About 1 hr to fix

    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 checkAnalyzer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkAnalyzer($property, $expectedAnalyzer): bool
        {
            $isAnalyzerCorrect = true;
    
            if ($property['type'] === self::FIELD_TYPE_TEXT || $property['type'] === self::FIELD_TYPE_KEYWORD) {
    Severity: Minor
    Found in src/module-elasticsuite-core/Index/Mapping/Field.php - About 45 mins to fix

    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 getFieldAnalyzers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getFieldAnalyzers(): array
        {
            $analyzers = [];
    
            // By default, texts are indexed with "keyword" analyzer which is a 'noop' analyzer.
    Severity: Minor
    Found in src/module-elasticsuite-core/Index/Mapping/Field.php - About 45 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status