Smile-SA/elasticsuite

View on GitHub

Showing 1,375 of 1,375 total issues

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

        $name,
        $field,
        array $metrics = [],
        array $childBuckets = [],
        array $pipelines = [],

    Method create has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $storeId,
            $containerName,
            $from,
            $size,
            $query = null,
    Severity: Major
    Found in src/module-elasticsuite-core/Search/Request/Builder.php - About 1 hr to fix

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

              ReinitableConfigInterface $config,
              ManagerInterface $eventManager,
              Structure $configStructure,
              TransactionFactory $transactionFactory,
              Loader $configLoader,

        Function prepareIndexValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function prepareIndexValue($attributeId, $storeId, $value)
            {
                // Backward compatibility.
                if (!is_numeric($attributeId)) {
                    $attributeId = $this->getAttributeId($attributeId);
        Severity: Minor
        Found in src/module-elasticsuite-catalog/Helper/AbstractAttribute.php - About 1 hr 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 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $name,
                array $sourceFields = [],
                int $size = 1,
                $sortOrder = BucketInterface::SORT_ORDER_COUNT,
                array $metrics = [],

          Function getItems has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getItems()
              {
                  $result = [];
          
                  if ($this->configurationHelper->isEnabled($this->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 buildAggregation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              private function buildAggregation(ContainerConfigurationInterface $containerConfig, $filters, $bucketParams)
              {
                  $bucketType = $bucketParams['type'];
                  $fieldName  = $bucketParams['field'] ?? $bucketParams['name'];
                  $logicalOperator = FieldInterface::FILTER_LOGICAL_OPERATOR_OR;

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

                  \Magento\Framework\Model\Context $context,
                  \Magento\Framework\Registry $registry,
                  IndexerRegistry $indexerRegistry,
                  ThesaurusFactory $thesaurusFactory,
                  ResourceConnection $resourceConnection,
          Severity: Major
          Found in src/module-elasticsuite-thesaurus/Model/Thesaurus.php - About 1 hr to fix

            Function addOptionsData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                private function addOptionsData(array $items, $options)
                {
                    $optionPosition = 0;
                    if (!empty($options)) {
                        foreach ($options as $option) {

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

                private function sortFilters($layerType, $filters)
                {
                    if ($layerType === Resolver::CATALOG_LAYER_CATEGORY) {
                        if ($this->searchContext->getCurrentCategory() && $this->searchContext->getCurrentCategory()->getId()) {
                            try {

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

                public function keepLatest(int $number)
                {
                    if ($number === 0) {
                        return;
                    }
            Severity: Minor
            Found in src/module-elasticsuite-tracker/Model/IndexManager.php - About 1 hr 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 getSwatchData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getSwatchData(): array
                {
                    // Fallback to core if sorting is set to manual.
                    if ($this->eavAttribute->getFacetSortOrder() === BucketInterface::SORT_ORDER_MANUAL) {
                        return parent::getSwatchData();

            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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if (position === 'top') {
                            borderValue = alignBorderValue(me.bottom);
                            ty1 = me.bottom - tl;
                            ty2 = borderValue - axisHalfWidth;
                            y1 = alignBorderValue(chartArea.top) + axisHalfWidth;
            src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 4533..4569

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 75.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        } else if (position === 'bottom') {
                            borderValue = alignBorderValue(me.top);
                            y1 = chartArea.top;
                            y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;
                            ty1 = borderValue + axisHalfWidth;
            src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 4539..4569

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 75.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        } else if (position === 'right') {
                            borderValue = alignBorderValue(me.left);
                            x1 = chartArea.left;
                            x2 = alignBorderValue(chartArea.right) - axisHalfWidth;
                            tx1 = borderValue + axisHalfWidth;
            src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 4527..4569

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 75.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function execute($entity, $arguments = [])
                {
                    $attributeData = $entity->getData(self::ATTRIBUTE_CODE);
            
                    if ($attributeData !== 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 getQueryFilter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getQueryFilter(): ?QueryInterface
                {
                    $query = null;
            
                    $this->category->setIsActive(true);
            Severity: Minor
            Found in src/module-elasticsuite-virtual-category/Model/Preview.php - About 1 hr 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        } else if (position === 'left') {
                            borderValue = alignBorderValue(me.right);
                            tx1 = me.right - tl;
                            tx2 = borderValue - axisHalfWidth;
                            x1 = alignBorderValue(chartArea.left) + axisHalfWidth;
            src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 4521..4569

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 75.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method prepareCategoryNameSelect has 46 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                private function prepareCategoryNameSelect($loadCategoryIds, $storeId)
                {
                    $rootCategoryId = (int) $this->storeManager->getStore($storeId)->getRootCategoryId();
                    $this->categoryNameCache[$storeId][$rootCategoryId] = '';
            
            

              Method buildAggregations has 46 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                  public function buildAggregations(array $buckets = [])
                  {
                      $aggregations = [];
              
                      foreach ($buckets as $bucket) {
                Severity
                Category
                Status
                Source
                Language