Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-core/Index/Analysis/Config/Converter.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method getLanguageConfiguration has 51 lines of code (exceeds 40 allowed). Consider refactoring.
Open

    private function getLanguageConfiguration(\DOMXPath $xpath, $language, array $defaultConfig)
    {
        $languageCharFilters = $this->parseFilters(
            $xpath,
            self::CHAR_FILTER_TYPE_ROOT_NODE,
Severity: Major
Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.php - About 1 hr to fix

    Method parseAnalyzers has 43 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

        private function parseAnalyzers(
            \DOMXPath $xpath,
            array $availableCharFilters,
            array $availableFilters,
            $language = self::LANGUAGE_DEFAULT,
    Severity: Minor
    Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.php - About 1 hr to fix

      Function parseFilters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private function parseFilters(\DOMXPath $xpath, $rootNodeName, $nodeName, $language = self::LANGUAGE_DEFAULT)
          {
              $filters = [];
              $languagePath = sprintf("[@language='%s']", $language);
              $searchPath   = sprintf("/%s/%s/%s%s", self::ROOT_NODE_NAME, $rootNodeName, $nodeName, $languagePath);
      Severity: Minor
      Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.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

      Method parseAnalyzers has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              \DOMXPath $xpath,
              array $availableCharFilters,
              array $availableFilters,
              $language = self::LANGUAGE_DEFAULT,
              $typeRootNode = self::ANALYZER_TYPE_ROOT_NODE,
      Severity: Minor
      Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.php - About 45 mins to fix

        Function parseAnalyzers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function parseAnalyzers(
                \DOMXPath $xpath,
                array $availableCharFilters,
                array $availableFilters,
                $language = self::LANGUAGE_DEFAULT,
        Severity: Minor
        Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.php - About 25 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