Smile-SA/elasticsuite

View on GitHub

Showing 1,375 of 1,375 total issues

Avoid deeply nested control flow statements.
Open

        for (var key in json) {
          if (Object.prototype.hasOwnProperty.call(json, key)) {
            html += '<li>';
            var keyRepr = options.withQuotes ?
              '<span class="json-string">"' + key + '"</span>' : key;

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

            QueryBuilder $subject,
            \Closure $proceed,
            ContainerConfigurationInterface $containerConfiguration,
            $queryText,
            array $filters,
    Severity: Minor
    Found in src/module-elasticsuite-catalog-optimizer/Plugin/QueryRewrite.php - About 45 mins to fix

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

              RequestFactory $requestFactory,
              QueryBuilder $queryBuilder,
              QueryFactory $queryFactory,
              CategoryQuery $categoryQuery,
              SearchQuery $searchQuery,

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

                Context $context,
                PageFactory $resultPageFactory,
                Registry $coreRegistry,
                OptimizerRepositoryInterface $optimizerRepository,
                OptimizerInterfaceFactory $optimizerFactory,

          Avoid deeply nested control flow statements.
          Open

                    if (isCollapsable(json[i])) {
                      html += '<a href class="json-toggle"></a>';
                    }

            Avoid deeply nested control flow statements.
            Open

                      if (i < json.length - 1) {
                        html += ',';
                      }

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

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

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

                    public function getActiveFilters()
                    {
                        $activeFilters = [];
                
                        if (!$this->isInline()) {
                Severity: Minor
                Found in src/module-elasticsuite-catalog/Block/Navigation.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 modifyAggregations has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        $storeId,
                        $requestName,
                        $aggregations,
                        $query,
                        $filters,

                  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

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

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

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

                                    ResourceConnection $resource,
                                    StoreManagerInterface $storeManager,
                                    MetadataPool $metadataPool,
                                    ProductType $catalogProductType,
                                    Config $eavConfig,

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

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

                                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

                                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

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

                                    public function modifyAggregations($storeId, $requestName, $aggregations, $query, $filters, $queryFilters)
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language