Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

File chart.js has 12846 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Chart.js v3.3.2
 * https://www.chartjs.org
 * (c) 2021 Chart.js Contributors
 * Released under the MIT License
Severity: Major
Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 mo to fix

    Function smileTracker has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
    Open

    const smileTracker = (function () {
    
        "use strict";
    
        const guid = (function() {
    Severity: Minor
    Found in src/module-elasticsuite-tracker/view/frontend/web/js/tracking.js - About 1 day 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 smileTracker has 279 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

    const smileTracker = (function () {
    
        "use strict";
    
        const guid = (function() {
    Severity: Major
    Found in src/module-elasticsuite-tracker/view/frontend/web/js/tracking.js - About 1 day to fix

      File slider.js has 568 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * jQuery UI Slider - v1.10.4
       * http://jqueryui.com
       *
       * Copyright 2014 jQuery Foundation and other contributors
      Severity: Major
      Found in src/module-elasticsuite-catalog/view/frontend/web/js/slider.js - About 1 day to fix

        Function afterCreateCollection has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
        Open

            public function afterCreateCollection(ProductsList $subject, $collection)
            {
                $storeId    = $this->getCurrentStoreId($subject);
                $sortOption = $subject->getData('sort_order');
                $conditionOption = $subject->getData('condition_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 extractTermStatsByPosition has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

            private function extractTermStatsByPosition($termVectors, $useAllTokens = false)
            {
                $statByPosition = [];
                $analyzers      = [
                    FieldInterface::ANALYZER_STANDARD,

        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 FrontPlugin.php has 452 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

          Collection has 32 functions (exceeds 10 allowed). Consider refactoring.
          Open

          class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
          {
              /**
               * @var QueryResponse
               */

            Client has 29 functions (exceeds 10 allowed). Consider refactoring.
            Open

            class Client implements ClientInterface
            {
                /**
                 * @var \OpenSearch\Client
                 */
            Severity: Minor
            Found in src/module-elasticsuite-core/Client/Client.php - About 5 hrs to fix

              File Collection.php has 378 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

                Function _computeLabelItems has 139 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                        _computeLabelItems(chartArea) {
                            const me = this;
                            const axis = me.axis;
                            const options = me.options;
                            const {position, ticks: optionTicks} = options;
                Severity: Major
                Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 4 hrs to fix

                  Function saveAndReplaceThesaurus has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function saveAndReplaceThesaurus(): void
                      {
                          $behavior = $this->getBehavior();
                          $rows = [];
                          while ($bunch = $this->_dataSourceModel->getNextBunch()) {
                  Severity: Minor
                  Found in src/module-elasticsuite-thesaurus/Model/Import/Thesaurus.php - About 4 hrs 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

                  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

                      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.

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