Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

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

    private function getCurrentCategoryId(ContainerConfigurationInterface $containerConfiguration, SearchCriteriaInterface $searchCriteria)
    {
        if ($this->searchContext->getCurrentCategory() && $this->searchContext->getCurrentCategory()->getId()) {
            return $this->searchContext->getCurrentCategory()->getId();
        }
Severity: Minor
Found in src/module-elasticsuite-catalog/Plugin/Search/RequestMapperPlugin.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 modifyAttributes has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $storeId,
        $requestName,
        $attributes,
        $query,
        $filters,

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

        public function modifyData(array $data)
        {
            $optimizer = $this->locator->getOptimizer();
    
            if ($optimizer && $optimizer->getId() && isset($data[$optimizer->getId()])) {

    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,
            CatalogHelper $catalogHelper,
            EncoderInterface $jsonEncoder,
            FormatInterface $localeFormat,
            CatalogSliderHelper $catalogSliderHelper,
    Severity: Minor
    Found in src/module-elasticsuite-catalog/Block/Navigation/Renderer/Slider.php - About 45 mins to fix

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

          private function addDefaultSortOrders($sortOrders, $containerConfiguration)
          {
              if ($containerConfiguration->getName() == "catalog_view_container" && empty($sortOrders)) {
                  $sortOrders['position'] = ['direction' => SortOrderInterface::SORT_ASC];
              }
      Severity: Minor
      Found in src/module-elasticsuite-catalog/Plugin/Search/RequestMapperPlugin.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 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

                Yesno $booleanSource,
                Weight $weightSource,
                Registry $coreRegistry,
                FilterSortOrder $filterSortOrder,
                FilterBooleanLogic $filterBooleanLogic,

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

              public function modifyAggregations($storeId, $requestName, $aggregations, $query, $filters, $queryFilters)

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

                public function modifyAggregations($storeId, $requestName, $aggregations, $query, $filters, $queryFilters)

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

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

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

                    private function loadCategoryNames($categoryIds, $storeId)
                    {
                        $loadCategoryIds = $categoryIds;
                
                        if (isset($this->categoryNameCache[$storeId])) {

                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 modifyAttributes has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

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

                      public function modifyAggregations($storeId, $requestName, $aggregations, $query, $filters, $queryFilters)

                    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 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

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

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

                                Context $context,
                                Structure $configStructure,
                                ConfigSectionChecker $sectionChecker,
                                Factory $configFactory,
                                FrontendInterface $cache,

                          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

                          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 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

                          Severity
                          Category
                          Status
                          Source
                          Language