Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

Method __construct has 8 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\Catalog\Model\Layer\Resolver $layerResolver,
Severity: Major
Found in src/module-elasticsuite-tracker/Block/Variables/Page/Search.php - About 1 hr to fix

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

            CategoryAttributeQuery $categoryAttributeQuery,
            CategoryAttributesMapper $categoryAttributesMapper,
            RootCategoryProvider $rootCategoryProvider,
            LayerFormatter $layerFormatter,
            ResourceConnection $resourceConnection,

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

              Context $context,
              PageFactory $resultPageFactory,
              Registry $coreRegistry,
              ThesaurusRepositoryInterface $thesaurusRepository,
              ThesaurusFactory $thesaurusFactory,

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

                \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
                \Psr\Log\LoggerInterface $logger,
                \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
                \Magento\Framework\Event\ManagerInterface $eventManager,
                \Magento\Store\Model\StoreManagerInterface $storeManager,

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

                  Template\Context $context,
                  Data $jsonHelper,
                  TrackerHelper $trackerHelper,
                  Registry $registry,
                  PageTypeConfig $pageTypeConfig,
          Severity: Major
          Found in src/module-elasticsuite-tracker/Block/Variables/Page/Base.php - About 1 hr to fix

            Function canApply has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function canApply() : bool
                {
                    if (empty($this->optimizer->getSearchContainer())) {
                        return false;
                    }
            Severity: Minor
            Found in src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview.php - About 55 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 getElasticsuiteIndexMaxSize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getElasticsuiteIndexMaxSize()
                {
                    if ($this->indexStatsProvider->getElasticSuiteIndices() !== null) {
                        $elasticsuiteIndices = $this->indexStatsProvider->getElasticSuiteIndices();
                        $indexSizes = [];

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

                public function afterGetFilters(
                    RequestMapper $subject,
                    $result,
                    ContainerConfigurationInterface $containerConfiguration,
                    SearchCriteriaInterface $searchCriteria
            Severity: Minor
            Found in src/module-elasticsuite-catalog/Plugin/Search/RequestMapperPlugin.php - About 55 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 getNumberOfGhostIndices has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getNumberOfGhostIndices()
                {
                    if ($this->indexStatsProvider->getElasticSuiteIndices() !== null) {
                        $elasticsuiteIndices = $this->indexStatsProvider->getElasticSuiteIndices();
                        $ghostIndices = [];

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

                public function buildBucket(BucketInterface $bucket)
                {
                    if ($bucket->getType() !== BucketInterface::TYPE_TERM) {
                        throw new \InvalidArgumentException("Query builder : invalid aggregation type {$bucket->getType()}.");
                    }

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

                private function getSpanQuery(ContainerConfigurationInterface $containerConfig, $queryText, $boost)
                {
                    $query = null;
                    $terms = explode(' ', $queryText);
            
            

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

                private function parseTermVectors($termVectors, $cutoffFrequencyLimit, $useAllTokens = false)
                {
                    $queryTermStats = ['stop' => 0, 'exact' => 0, 'standard' => 0, 'missing' => 0];
                    $statByPosition = $this->extractTermStatsByPosition($termVectors, $useAllTokens);
            
            

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

                private function getLayerVariables()
                {
                    $variables = [];
                    $layer     = $this->catalogLayer;
            
            
            Severity: Minor
            Found in src/module-elasticsuite-tracker/Block/Variables/Page/Catalog.php - About 55 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 deleteThesaurusFinish has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function deleteThesaurusFinish(array $thesaurusIds): bool
                {
                    if ($thesaurusIds) {
                        try {
                            foreach ($thesaurusIds as $thesaurusId) {
            Severity: Minor
            Found in src/module-elasticsuite-thesaurus/Model/Import/Thesaurus.php - About 55 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 buildCategorySearchQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function buildCategorySearchQuery($category, $excludedCategories = []): ?QueryInterface
                {
                    $query = null;
            
                    if (!in_array($category->getId(), $excludedCategories)) {
            Severity: Minor
            Found in src/module-elasticsuite-virtual-category/Model/Rule.php - About 55 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 combineSynonyms has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function combineSynonyms($queryText, $synonymByPositions, $maxRewrites, $substitutions = 0, $offset = 0)
                {
                    $combinations = [];
            
                    if (!empty($synonymByPositions) && $substitutions < $maxRewrites) {
            Severity: Minor
            Found in src/module-elasticsuite-thesaurus/Model/Index.php - About 55 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 postProcessResponse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function postProcessResponse($data)
                {
                    $terms = array_keys($data);
            
                    $storeId        = $this->context->getStoreId();

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

                private function getCategorySearchQuery($excludedCategories): ?QueryInterface
                {
                    $categoryIds = [];
                    $subQueries  = [];
                    $valueArray  = $this->getValue();

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

                private function loadVariationsFromSearchIndex(Product $parentProduct, array $attributes)
                {
                    $documentSource = $parentProduct->getDocumentSource();
                    $childrenIds    = isset($documentSource['children_ids']) ? $documentSource['children_ids'] : [];
                    $variation      = false;
            Severity: Minor
            Found in src/module-elasticsuite-swatches/Helper/Swatches.php - About 55 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 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
                    \Psr\Log\LoggerInterface $logger,
                    \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
                    \Magento\Framework\Event\ManagerInterface $eventManager,
                    \Magento\Framework\Stdlib\DateTime\DateTime $date,
              Severity
              Category
              Status
              Source
              Language