Smile-SA/elasticsuite

View on GitHub

Showing 1,375 of 1,375 total issues

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

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

        \Smile\ElasticsuiteCore\Search\Request\Builder $searchRequestBuilder,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Smile\ElasticsuiteCore\Api\Search\Request\ContainerConfigurationInterfaceFactory $containerConfigFactory,
        \Smile\ElasticsuiteCore\Api\Search\ContextInterface $searchContext,
        \Magento\Search\Model\QueryFactory $queryFactory,
Severity: Minor
Found in src/module-elasticsuite-core/Model/Search/RequestBuilder.php - About 45 mins to fix

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

        public function getIndexOptionText($attributeId, $storeId, $optionId)
        {
            $attribute = $this->getAttributeByStore($attributeId, $storeId);
    
            if (!isset($this->attributeOptionTextCache[$storeId]) || !isset($this->attributeOptionTextCache[$storeId][$attributeId])) {
    Severity: Minor
    Found in src/module-elasticsuite-catalog/Helper/AbstractAttribute.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,
            Structure $configStructure,
            ConfigSectionChecker $sectionChecker,
            Factory $configFactory,
            FrontendInterface $cache,

      Avoid deeply nested control flow statements.
      Open

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

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

                \Smile\ElasticsuiteCore\Api\Search\ContextInterface $contextInterface,
                \Smile\ElasticsuiteVirtualCategory\Helper\Rule $helper,
                \Magento\Store\Model\StoreManagerInterface $storeManager,
                \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
                \Smile\ElasticsuiteVirtualCategory\Model\VirtualCategory\Root $virtualCategoryRoot,

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

              private function addCustomerLink(&$eventData)
              {
                  // The customerId should be sent by the frontend, if any.
                  $customerId = $eventData['customer']['id'] ?? null;
                  if ($customerId !== null && ((int) $customerId > 0)) {
          Severity: Minor
          Found in src/module-elasticsuite-tracker/Model/Customer/TrackingService.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 aroundCreate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function aroundCreate(
                  QueryBuilder $subject,
                  \Closure $proceed,
                  ContainerConfigurationInterface $containerConfig,
                  $queryText,
          Severity: Minor
          Found in src/module-elasticsuite-thesaurus/Plugin/QueryRewrite.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

                  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

            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

                      JsonHelper $jsonHelper,
                      ImportHelper $importExportData,
                      Data $importData,
                      Helper $resourceHelper,
                      ProcessingErrorAggregatorInterface $errorAggregator,
              Severity: Minor
              Found in src/module-elasticsuite-thesaurus/Model/Import/Thesaurus.php - About 45 mins to fix

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

                        Context $context,
                        Registry $registry,
                        FormFactory $formFactory,
                        Store $systemStore,
                        Yesno $booleanSource,

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

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

                    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

                    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

                      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

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

                          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
                            Severity
                            Category
                            Status
                            Source
                            Language