Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

Function getEffectOnProduct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function getEffectOnProduct($baseProductIds, $optimizedProductIds, $productId)
    {
        $result                   = 0;
        $baseProductPosition      = array_search($productId, $baseProductIds);
        $optimizedProductPosition = array_search($productId, $optimizedProductIds);
Severity: Minor
Found in src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview.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

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

        Context $context,
        PageFactory $resultPageFactory,
        FileFactory $fileFactory,
        Filesystem $filesystem,
        CollectionFactory $attributeCollectionFactory,

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

        public function modifyAttributes($storeId, $requestName, $attributes, $query, $filters, $queryFilters)

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

              JsonHelper $jsonHelper,
              ImportHelper $importExportData,
              Data $importData,
              Config $eavConfig,
              Helper $resourceHelper,
      Severity: Minor
      Found in src/module-elasticsuite-catalog/Model/Import/ProductAttribute.php - About 45 mins to fix

        Function parsePipelineBucketsPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function parsePipelineBucketsPath(\DOMXPath $xpath, \DOMNode $pipelineNode)
            {
                $bucketsPath = null;
        
                foreach ($xpath->query(self::PIPELINE_COMPLEX_BUCKETS_PATH, $pipelineNode) as $bucketsPathMappingNode) {

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

              public function build(array $options = []): \OpenSearch\Client
              {
                  $options       = array_merge($this->defaultOptions, $options);
          
                  $clientBuilder = $this->clientBuilder->create();
          Severity: Minor
          Found in src/module-elasticsuite-core/Client/ClientBuilder.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 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

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

                  ItemFactory $itemFactory,
                  QueryFactory $queryFactory,
                  TermDataProvider $termDataProvider,
                  CategoryCollectionFactory $categoryCollectionFactory,
                  ConfigurationHelper $configurationHelper,

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

                    $index,
                    $queryText,
                    $cutoffFrequency,
                    $isUsingAllTokens,
                    $isUsingReference,
            Severity: Minor
            Found in src/module-elasticsuite-core/Search/Spellchecker/Request.php - About 45 mins to fix

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

                      \Magento\Framework\Search\Request\QueryInterface $query,
                      $functions = [],
                      $name = null,
                      $scoreMode = self::SCORE_MODE_SUM,
                      $boostMode = self::BOOST_MODE_SUM,
              Severity: Minor
              Found in src/module-elasticsuite-core/Search/Request/Query/FunctionScore.php - About 45 mins to fix

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

                        \Magento\Framework\ObjectManagerInterface $objectManager,
                        \Smile\ElasticsuiteCore\Api\Client\ClientInterface $client,
                        \Smile\ElasticsuiteCore\Api\Client\ClientConfigurationInterface $clientConfiguration,
                        \Smile\ElasticsuiteCore\Api\Index\IndexSettingsInterface $indexSettings,
                        PipelineManagerInterface $pipelineManager,
                Severity: Minor
                Found in src/module-elasticsuite-core/Index/AsyncIndexOperation.php - About 45 mins to fix

                  Function initScope has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function initScope()
                      {
                          if ($this->getSection() === null) {
                              $this->setSection('');
                          }
                  Severity: Minor
                  Found in src/module-elasticsuite-core/Model/Search/Request/RelevanceConfig.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

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

                          string $queryText,
                          int $kValue,
                          string $field = self::DEFAULT_EMBEDDING_FIELD,
                          ?string $name = null,
                          float $boost = QueryInterface::DEFAULT_BOOST_VALUE,

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

                            $queryText,
                            $field,
                            $cutoffFrequency = self::DEFAULT_CUTOFF_FREQUENCY,
                            $minimumShouldMatch = self::DEFAULT_MINIMUM_SHOULD_MATCH,
                            $name = null,
                    Severity: Minor
                    Found in src/module-elasticsuite-core/Search/Request/Query/Common.php - About 45 mins to fix

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

                              StoreManagerInterface $storeManager,
                              Manager $moduleManager,
                              FieldIterator $childrenIterator,
                              Factory $cloneModelFactory,
                              Mapper $dependencyMapper,

                        Function getScopeCode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getScopeCode()
                            {
                                $scopeCode = $this->getData('scope_code');
                        
                                if ($scopeCode === null) {

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

                            public function getAnalysisSettings($store)
                            {
                                $language = $this->helper->getLanguageCode($store);
                                $settings = $this->analysisConfig->get($language);
                        
                        
                        Severity: Minor
                        Found in src/module-elasticsuite-core/Index/IndexSettings.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 toOptionArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function toOptionArray()
                            {
                                $options = [
                                    [
                                        'label' => __('Please select a stemmer for the store'),
                        Severity: Minor
                        Found in src/module-elasticsuite-core/Model/Config/Source/Stemmers.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

                        Severity
                        Category
                        Status
                        Source
                        Language