Smile-SA/elasticsuite

View on GitHub

Showing 1,375 of 1,375 total issues

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

    public function afterAddProduct(
        Quote $subject,
        $result
    ) {
        if (!$this->trackerHelper->isHeadlessMode()) {
Severity: Minor
Found in src/module-elasticsuite-tracker/Plugin/QuotePlugin.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 modifyAttributes has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

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

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

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

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

        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

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

                    if (inAreaNext) {
                        point.cp2x = capControlPoint(point.cp2x, area.left, area.right);
                        point.cp2y = capControlPoint(point.cp2y, area.top, area.bottom);
                    }
        Severity: Minor
        Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js and 1 other location - About 45 mins to fix
        src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 5412..5415

        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 65.

        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

                    if (inAreaPrev) {
                        point.cp1x = capControlPoint(point.cp1x, area.left, area.right);
                        point.cp1y = capControlPoint(point.cp1y, area.top, area.bottom);
                    }
        Severity: Minor
        Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js and 1 other location - About 45 mins to fix
        src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 5416..5419

        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 65.

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

              public function execute($entity, $arguments = [])
              {
                  $attributeData = $entity->getData(self::ATTRIBUTE_CODE);
          
                  if (!is_object($attributeData)) {

          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 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

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

                  $selectExpanded = $connection->select()
                      ->from(['expanded' => $expandedTableName], ['term', 'thesaurus_id', 'count' => 'COUNT(*)'])
                      ->where('expanded.term IN (?)', $terms)
                      ->where('expanded.thesaurus_id != ?', $this->getId())
                      ->group(['term', 'thesaurus_id'])
          Severity: Minor
          Found in src/module-elasticsuite-thesaurus/Model/Thesaurus.php and 1 other location - About 45 mins to fix
          src/module-elasticsuite-thesaurus/Model/Thesaurus.php on lines 330..334

          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 65.

          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

                  $selectReference = $connection->select()
                      ->from(['reference' => $referenceTableName], ['term', 'thesaurus_id', 'count' => 'COUNT(*)'])
                      ->where('reference.term IN (?)', $terms)
                      ->where('reference.thesaurus_id != ?', $this->getId())
                      ->group(['term', 'thesaurus_id']);
          Severity: Minor
          Found in src/module-elasticsuite-thesaurus/Model/Thesaurus.php and 1 other location - About 45 mins to fix
          src/module-elasticsuite-thesaurus/Model/Thesaurus.php on lines 323..327

          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 65.

          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

                      previous: {
                          x: current.x - fa * (next.x - previous.x),
                          y: current.y - fa * (next.y - previous.y)
                      },
          Severity: Minor
          Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js and 1 other location - About 40 mins to fix
          src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 5315..5318

          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 64.

          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

                      if (me.isHorizontal()) {
                          x1 = _alignPixel(chart, me.left, axisWidth) - axisWidth / 2;
                          x2 = _alignPixel(chart, me.right, lastLineWidth) + lastLineWidth / 2;
                          y1 = y2 = borderValue;
                      } else {
          Severity: Minor
          Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js and 1 other location - About 40 mins to fix
          src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 4911..4915

          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 64.

          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

                      next: {
                          x: current.x + fb * (next.x - previous.x),
                          y: current.y + fb * (next.y - previous.y)
                      }
          Severity: Minor
          Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js and 1 other location - About 40 mins to fix
          src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 5311..5314

          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 64.

          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 {
                          y1 = _alignPixel(chart, me.top, axisWidth) - axisWidth / 2;
                          y2 = _alignPixel(chart, me.bottom, lastLineWidth) + lastLineWidth / 2;
                          x1 = x2 = borderValue;
                      }
          Severity: Minor
          Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js and 1 other location - About 40 mins to fix
          src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js on lines 4907..4911

          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 64.

          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

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

              public function execute()
              {
                  $responseData = $this->getPreviewObject()->getData();
                  $json         = $this->jsonHelper->jsonEncode($responseData);
          
          
          src/module-elasticsuite-virtual-category/Controller/Adminhtml/Category/Virtual/Preview.php on lines 68..74

          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 44.

          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

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

                      if (is_array($fieldValue)) {
                          array_walk(
                              $fieldValue,
                              array($this, 'enforceField')
                          );
          src/module-elasticsuite-tracker/Model/Event/Mapping/TypeEnforcer/AbstractTypeEnforcer.php on lines 126..133

          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 44.

          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 8 locations. Consider refactoring.
          Open

              public function __construct(
                  \Magento\Store\Model\StoreManagerInterface $storeManager,
                  \Smile\ElasticsuiteCore\Api\Index\IndexSettingsInterface $indexSettings,
                  \Smile\ElasticsuiteCore\Api\Client\ClientInterface $client,
                  \Smile\ElasticsuiteCore\Api\Index\IndexOperationInterface $indexOperation,
          Severity: Major
          Found in src/module-elasticsuite-tracker/Model/IndexManager.php and 7 other locations - About 40 mins to fix
          src/module-elasticsuite-analytics/Model/Search/Usage/Terms/ConversionRatePostProcessor.php on lines 76..92
          src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Category.php on lines 95..111
          src/module-elasticsuite-catalog/Model/ProductSorter/AbstractPreview.php on lines 78..94
          src/module-elasticsuite-catalog/Plugin/Catalog/Eav/AttributePlugin.php on lines 115..131
          src/module-elasticsuite-catalog/Plugin/CatalogSearch/ResultPlugin.php on lines 88..104
          src/module-elasticsuite-core/Indexer/GenericIndexerHandler.php on lines 81..97
          src/module-elasticsuite-core/Search/Request/Query/Boolean.php on lines 76..92

          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 64.

          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 8 locations. Consider refactoring.
          Open

              public function __construct(
                  CategoryAttributeQuery $categoryAttributeQuery,
                  CategoryAttributesMapper $categoryAttributesMapper,
                  RootCategoryProvider $rootCategoryProvider,
                  LayerFormatter $layerFormatter,
          src/module-elasticsuite-analytics/Model/Search/Usage/Terms/ConversionRatePostProcessor.php on lines 76..92
          src/module-elasticsuite-catalog/Model/ProductSorter/AbstractPreview.php on lines 78..94
          src/module-elasticsuite-catalog/Plugin/Catalog/Eav/AttributePlugin.php on lines 115..131
          src/module-elasticsuite-catalog/Plugin/CatalogSearch/ResultPlugin.php on lines 88..104
          src/module-elasticsuite-core/Indexer/GenericIndexerHandler.php on lines 81..97
          src/module-elasticsuite-core/Search/Request/Query/Boolean.php on lines 76..92
          src/module-elasticsuite-tracker/Model/IndexManager.php on lines 79..95

          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 64.

          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

          Severity
          Category
          Status
          Source
          Language