Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

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

        Builder $searchRequestBuilder,
        SearchEngineInterface $searchEngine,
        Context $context,
        AggregationFactory $aggregationFactory,
        MetricFactory $metricFactory,

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

            Context $context,
            IndexOperationInterface $indexOperation,
            EventQueueInterface $eventQueue,
            AnalyticsHelper $config,
            ReportContext $reportContext,
    Severity: Minor
    Found in src/module-elasticsuite-analytics/Controller/Adminhtml/Search/Usage.php - About 45 mins to fix

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

          protected function processResponse(\Smile\ElasticsuiteCore\Search\Adapter\Elasticsuite\Response\QueryResponse $response)
          {
              $data = [];
      
              foreach ($this->getBucketValues($response) as $value) {

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

          private function getCategoriesQuery($categoriesFilter, $storeId)
          {
              $result = [];
      
              foreach ($categoriesFilter as $operator => $categoryIds) {

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

          public function aroundReindex(\Magento\Catalog\Model\Category $category, \Closure $proceed)
          {
              $proceed();
      
              // Reindex only if attached product list has changed.

      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

              Template\Context $context,
              \Magento\Framework\Json\Helper\Data $jsonHelper,
              \Smile\ElasticsuiteTracker\Helper\Data $trackerHelper,
              \Magento\Framework\Registry $registry,
              \Magento\Checkout\Model\Session $checkoutSession,
      Severity: Minor
      Found in src/module-elasticsuite-tracker/Block/Variables/Page/Order.php - About 45 mins to fix

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

                StoreManagerInterface $storeManager,
                CategoryRepositoryInterface $categoryRepository,
                Conditions $conditionsHelper,
                SkuPositionSortOrderBuilder $skuPositionSortOrderBuilder,
                Provider $filterProvider,

          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

                    Template\Context $context,
                    \Magento\Framework\Json\Helper\Data $jsonHelper,
                    \Smile\ElasticsuiteTracker\Helper\Data $trackerHelper,
                    \Magento\Framework\Registry $registry,
                    \Magento\Cms\Model\Page $page,
            Severity: Minor
            Found in src/module-elasticsuite-tracker/Block/Variables/Page/Cms.php - About 45 mins to fix

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

                  protected function isEventInvalid($data)
                  {
                      $isEventInvalid = true;
              
                      if (isset($data['page']['store_id']) && is_numeric($data['page']['store_id'])) {
              Severity: Minor
              Found in src/module-elasticsuite-tracker/Model/ResourceModel/EventQueue.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

              Avoid deeply nested control flow statements.
              Open

                                                  if ($queryFilter !== null) {
                                                      $filterQueries[] = $queryFilter;
                                                  }

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

                        ResolverInterface $subject,
                        Field $field,
                        $context,
                        ResolveInfo $info,
                        array $value = null,

                  Avoid deeply nested control flow statements.
                  Open

                                              if (!empty($filterQueries)) {
                                                  $query = $this->queryFactory->create(QueryInterface::TYPE_BOOL, ['should' => $filterQueries]);
                                                  $collection->addQueryFilter($query);
                                              }

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

                            SearchInterface $search,
                            SearchResultFactory $searchResultFactory,
                            FieldSelection $fieldSelection,
                            ProductSearch $productProvider,
                            SearchCriteriaBuilder $searchCriteriaBuilder,

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

                              ScopeConfigInterface $scopeConfig,
                              StoreManagerInterface $storeManager,
                              CategoryCollectionFactory $categoryCollectionFactory,
                              UrlFinderInterface $urlFinder,
                              UrlInterface $urlBuilder,
                      Severity: Minor
                      Found in src/module-elasticsuite-virtual-category/Model/Url.php - About 45 mins to fix

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

                            public function beforeGetImage(
                                \Magento\Catalog\Block\Product\AbstractProduct $subject,
                                \Magento\Catalog\Model\Product $product,
                                $location,
                                array $attributes = []
                        Severity: Minor
                        Found in src/module-elasticsuite-swatches/Model/Plugin/ProductImage.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

                        Consider simplifying this complex logical expression.
                        Open

                                        if ((this.options.values.length === 2 && this.options.range === true) &&
                                            ((index === 0 && newVal > otherVal) || (index === 1 && newVal < otherVal))
                                        ) {
                                            newVal = otherVal;
                                        }
                        Severity: Major
                        Found in src/module-elasticsuite-catalog/view/frontend/web/js/slider.js - About 40 mins to fix

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

                                  DbContext $context,
                                  RuleFactory $ruleFactory,
                                  SerializerInterface $serializer,
                                  array $containerToLimitationDataMapping = [],
                                  $connectionName = null

                            Function _updateBezierControlPoints has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                function _updateBezierControlPoints(points, options, area, loop, indexAxis) {
                            Severity: Minor
                            Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 35 mins to fix

                              Function _measureText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  function _measureText(ctx, data, gc, longest, string) {
                              Severity: Minor
                              Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language