Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

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

    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

      Function _computeGridLineItems has 110 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

              _computeGridLineItems(chartArea) {
                  const me = this;
                  const axis = me.axis;
                  const chart = me.chart;
                  const options = me.options;
      Severity: Major
      Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 3 hrs to fix

        FrontPlugin has 20 functions (exceeds 10 allowed). Consider refactoring.
        Open

        class FrontPlugin
        {
            /**
             * @var array
             */

          Function addData has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addData($storeId, array $indexData): array
              {
                  if ($this->ignorePositions->isIgnoreOosPositions($storeId)) {
                      foreach ($indexData as &$productData) {
                          if (isset($productData['stock']['is_in_stock']) && (bool) $productData['stock']['is_in_stock'] === false) {

          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

          RelevanceConfig has 19 functions (exceeds 10 allowed). Consider refactoring.
          Open

          class RelevanceConfig implements RelevanceConfigurationInterface
          {
              /**
               * @var string
               */

            Rule has 19 functions (exceeds 10 allowed). Consider refactoring.
            Open

            class Rule extends \Smile\ElasticsuiteCatalogRule\Model\Rule implements VirtualRuleInterface
            {
                /**
                 * @var QueryFactory
                 */
            Severity: Minor
            Found in src/module-elasticsuite-virtual-category/Model/Rule.php - About 3 hrs to fix

              Function drawPoint has 100 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                  function drawPoint(ctx, options, x, y) {
                      let type, xOffset, yOffset, size, cornerRadius;
                      const style = options.pointStyle;
                      const rotation = options.rotation;
                      const radius = options.radius;
              Severity: Major
              Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 3 hrs to fix

                File product-sorter.js has 306 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.

                  Thesaurus has 18 functions (exceeds 10 allowed). Consider refactoring.
                  Open

                  class Thesaurus extends \Magento\Framework\Model\AbstractModel implements ThesaurusInterface
                  {
                      /**
                       * Name of the Thesaurus Expanded Terms Mysql Table
                       */
                  Severity: Minor
                  Found in src/module-elasticsuite-thesaurus/Model/Thesaurus.php - About 3 hrs to fix

                    Function saveThesaurusFinish has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function saveThesaurusFinish(array $thesaurusData): bool
                        {
                            foreach ($thesaurusData as $thesaurusRows) {
                                foreach ($thesaurusRows as $row) {
                                    $model = $this->importProvider->createThesaurus();
                    Severity: Minor
                    Found in src/module-elasticsuite-thesaurus/Model/Import/Thesaurus.php - About 3 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

                    File Converter.php has 301 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-core/Index/Analysis/Config/Converter.php - About 3 hrs to fix

                      Function switchDefaultValueField has 95 lines of code (exceeds 40 allowed). Consider refactoring.
                      Open

                                      switchDefaultValueField: function () {
                                          var currentValue = this.frontendInput.val(),
                                              defaultValueTextVisibility = false,
                                              defaultValueTextareaVisibility = false,
                                              defaultValueDateVisibility = false,

                        AbstractAttribute has 17 functions (exceeds 10 allowed). Consider refactoring.
                        Open

                        abstract class AbstractAttribute extends Mapping
                        {
                            /**
                             * @var \Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory
                             */
                        Severity: Minor
                        Found in src/module-elasticsuite-catalog/Helper/AbstractAttribute.php - About 3 hrs to fix

                          Function addData has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function addData($storeId, array $indexData)
                              {
                                  $productIds = array_keys($indexData);
                                  $priceData  = $this->resourceModel->loadPriceData($storeId, $productIds);
                          
                          

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

                                  \Magento\Framework\Data\Collection\EntityFactory $entityFactory,
                                  \Psr\Log\LoggerInterface $logger,
                                  \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
                                  \Magento\Framework\Event\ManagerInterface $eventManager,
                                  \Magento\Eav\Model\Config $eavConfig,

                            MoreLikeThis has 16 functions (exceeds 10 allowed). Consider refactoring.
                            Open

                            class MoreLikeThis implements QueryInterface
                            {
                                /**
                                 * @var string
                                 */
                            Severity: Minor
                            Found in src/module-elasticsuite-core/Search/Request/Query/MoreLikeThis.php - About 3 hrs to fix

                              Data has 16 functions (exceeds 10 allowed). Consider refactoring.
                              Open

                              class Data extends \Magento\Framework\App\Helper\AbstractHelper
                              {
                                  /**
                                   * Module status configuration path
                                   * @var string
                              Severity: Minor
                              Found in src/module-elasticsuite-tracker/Helper/Data.php - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language