Smile-SA/elasticsuite

View on GitHub

Showing 1,375 of 1,375 total issues

Optimizer has 26 functions (exceeds 10 allowed). Consider refactoring.
Open

class Optimizer extends \Magento\Framework\Model\AbstractModel implements OptimizerInterface, IdentityInterface
{
    /**
     * @var string
     */
Severity: Minor
Found in src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php - About 4 hrs to fix

    Field has 26 functions (exceeds 10 allowed). Consider refactoring.
    Open

    class Field implements FieldInterface
    {
        /**
         * @var int
         */
    Severity: Minor
    Found in src/module-elasticsuite-core/Index/Mapping/Field.php - About 4 hrs to fix

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

          private function addExpansionFields($fieldset, $model)
          {
              $form = $fieldset->getForm();
      
              /* @var $bagRenderer \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Renderer\Expansions */
      src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php on lines 232..250

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

      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

          private function addSynonymFields($fieldset, $model)
          {
              $form = $fieldset->getForm();
      
              /* @var $synonymsRenderer \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Renderer\Synonyms */
      src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php on lines 203..222

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

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

          private function checkUpdateNeeded($subject)
          {
              $updateMapping = $cleanCache = $invalidateIndex = false;
      
              if ($this->saveIsNew === true) {

      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

      IndexSettings has 25 functions (exceeds 10 allowed). Consider refactoring.
      Open

      class IndexSettings extends AbstractConfiguration
      {
          /**
           * Location of ElasticSuite base settings configuration.
           *
      Severity: Minor
      Found in src/module-elasticsuite-core/Helper/IndexSettings.php - About 4 hrs to fix

        Switcher has 24 functions (exceeds 10 allowed). Consider refactoring.
        Open

        class Switcher extends Template
        {
            /**
             * Name of container variable
             *

          Factory has 24 functions (exceeds 10 allowed). Consider refactoring.
          Open

          class Factory
          {
              /**
               * XML root node for search relevance
               */

            File product-attributes.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * DISCLAIMER
             *
             * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
             * versions in the future.

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

              <?php
              /**
               * DISCLAIMER
               *
               * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
              src/module-elasticsuite-core/Search/Request/Query/Exists.php on lines 1..103

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

              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

              <?php
              /**
               * DISCLAIMER
               *
               * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
              Severity: Major
              Found in src/module-elasticsuite-core/Search/Request/Query/Exists.php and 1 other location - About 4 hrs to fix
              src/module-elasticsuite-core/Search/Request/Query/Missing.php on lines 1..103

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

              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 _draw has 116 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                      _draw() {
                          const me = this;
                          const {options: opts, columnSizes, lineWidths, ctx} = me;
                          const {align, labels: labelOpts} = opts;
                          const defaultColor = defaults.color;
              Severity: Major
              Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 4 hrs to fix

                File Rule.php has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * DISCLAIMER
                 *
                 * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
                Severity: Minor
                Found in src/module-elasticsuite-virtual-category/Model/Rule.php - About 4 hrs to fix

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

                      private function addTermExportData($termData)
                      {
                          $labelsByThesaurusId = [];
                  
                          foreach ($termData as $currentTerm) {
                  src/module-elasticsuite-thesaurus/Model/ResourceModel/Thesaurus/Collection.php on lines 333..352

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

                  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

                      private function addTermData($termData)
                      {
                          $labelsByThesaurusId = [];
                  
                          foreach ($termData as $currentTerm) {
                  src/module-elasticsuite-thesaurus/Model/ResourceModel/Thesaurus/Collection.php on lines 361..380

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

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

                      private function loadStores()
                      {
                          $itemIds = array_keys($this->_items);
                  
                          if (count($itemIds)) {

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

                      public function build(AggregationInterface $aggregation, ?int $storeId): array
                      {
                          $prefix = Mapping::OPTION_TEXT_PREFIX . '_';
                          $result = [];
                  
                  

                  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

                  File MutationObserver.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * @license
                   * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
                   * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
                   * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
                  Severity: Minor
                  Found in src/module-elasticsuite-core/view/base/web/js/MutationObserver.js - About 3 hrs to fix

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

                    <?php
                    /**
                     * DISCLAIMER
                     *
                     * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
                    src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/Span/SpanTerm.php on lines 1..52
                    src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/Term.php on lines 1..51

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

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

                    <?php
                    /**
                     * DISCLAIMER
                     *
                     * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
                    src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/Prefix.php on lines 1..51
                    src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/Span/SpanTerm.php on lines 1..52

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

                    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