Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

File form-mini.js has 290 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.
Severity: Minor
Found in src/module-elasticsuite-core/view/frontend/web/js/form-mini.js - About 2 hrs to fix

    Function migrateDailyToMonthlyIndices has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function migrateDailyToMonthlyIndices(): void
        {
            $indexIdentifiers = [SessionIndexInterface::INDEX_IDENTIFIER, EventIndexInterface::INDEX_IDENTIFIER];
    
            foreach ($indexIdentifiers as $indexIdentifier) {
    Severity: Minor
    Found in src/module-elasticsuite-tracker/Model/IndexManager.php - About 2 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

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

    class Collection extends \Magento\Catalog\Model\ResourceModel\Category\Collection
    {
        /**
         * @var \Smile\ElasticsuiteCore\Search\Request\Builder
         */

      IndexOperation has 15 functions (exceeds 10 allowed). Consider refactoring.
      Open

      class IndexOperation implements IndexOperationInterface
      {
          /**
           * @var \Magento\Framework\ObjectManagerInterface
           */
      Severity: Minor
      Found in src/module-elasticsuite-core/Index/IndexOperation.php - About 2 hrs to fix

        ClientConfiguration has 15 functions (exceeds 10 allowed). Consider refactoring.
        Open

        class ClientConfiguration implements ClientConfigurationInterface
        {
            /**
             * Location of Elasticsearch client configuration.
             *
        Severity: Minor
        Found in src/module-elasticsuite-core/Client/ClientConfiguration.php - About 2 hrs to fix

          File tracking.js has 282 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* global document: true */
          /* global window: true */
          /* global console: true */
          /* exported smileTracker */
          
          
          Severity: Minor
          Found in src/module-elasticsuite-tracker/view/frontend/web/js/tracking.js - About 2 hrs to fix

            Function generateTicks$1 has 82 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                function generateTicks$1(generationOptions, dataRange) {
                    const ticks = [];
                    const MIN_SPACING = 1e-14;
                    const {bounds, step, min, max, precision, count, maxTicks, maxDigits, includeBounds} = generationOptions;
                    const unit = step || 1;
            Severity: Major
            Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 2 hrs to fix

              Slider has 14 functions (exceeds 10 allowed). Consider refactoring.
              Open

              class Slider extends AbstractRenderer
              {
                  /**
                   * The Data role, used for Javascript mapping of slider Widget
                   *
              Severity: Minor
              Found in src/module-elasticsuite-catalog/Block/Navigation/Renderer/Slider.php - About 2 hrs to fix

                Function _onPropertyChange has 80 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                        _onPropertyChange: _.debounce(function () {
                            var searchField = this.element,
                                clonePosition = {
                                    position: 'absolute',
                                    // Removed to fix display issues
                Severity: Major
                Found in src/module-elasticsuite-core/view/frontend/web/js/form-mini.js - About 2 hrs to fix

                  Function stringToBoolConverting has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function stringToBoolConverting($data, array $stringToBoolInputs = null)
                      {
                          if (null === $stringToBoolInputs) {
                              $stringToBoolInputs = $this->stringToBoolInputs;
                          }

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

                      public function modifyAggregations($storeId, $requestName, $aggregations, $query, $filters, $queryFilters)
                      {
                          if ($this->sliderHelper->isAdaptiveSliderEnabled()) {
                              foreach ($this->applicableAttributes as $attribute) {
                                  $field = $this->requestFieldMapper->getMappedFieldName($attribute->getAttributeCode());

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

                      public function buildAggregations(array $buckets = [])
                      {
                          $aggregations = [];
                  
                          foreach ($buckets as $bucket) {

                  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

                  ContainerConfiguration has 13 functions (exceeds 10 allowed). Consider refactoring.
                  Open

                  class ContainerConfiguration implements ContainerConfigurationInterface
                  {
                      /**
                       * @var string
                       */

                    Mapping has 13 functions (exceeds 10 allowed). Consider refactoring.
                    Open

                    class Mapping implements MappingInterface
                    {
                        /**
                         * @var string
                         */
                    Severity: Minor
                    Found in src/module-elasticsuite-core/Index/Mapping.php - About 2 hrs to fix

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

                      class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
                      {
                          /**
                           * Store for filter
                           *

                        Url has 13 functions (exceeds 10 allowed). Consider refactoring.
                        Open

                        class Url
                        {
                            /**
                             * XML path for product url suffix
                             */
                        Severity: Minor
                        Found in src/module-elasticsuite-virtual-category/Model/Url.php - About 2 hrs to fix

                          Function getSubtreeBreadcrumbPath has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function getSubtreeBreadcrumbPath($helper, $appliedRoot)
                              {
                                  if (!$this->categoryPath) {
                                      $path     = [];
                                      $category = $helper->getCategory();

                          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

                          Preview has 12 functions (exceeds 10 allowed). Consider refactoring.
                          Open

                          class Preview extends Action
                          {
                              /**
                               * @var \Smile\ElasticsuiteCatalogOptimizer\Model\Optimizer\PreviewFactory
                               */

                            Product has 12 functions (exceeds 10 allowed). Consider refactoring.
                            Open

                            class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct
                            {
                                /**
                                 * @var AttributeList
                                 */
                            Severity: Minor
                            Found in src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product.php - About 2 hrs to fix

                              Condition has 12 functions (exceeds 10 allowed). Consider refactoring.
                              Open

                              class Condition extends AbstractSimpleObject implements ConditionInterface
                              {
                                  const KEY_CONDITION_TYPE = 'condition_type';
                                  const KEY_CONDITIONS = 'conditions';
                                  const KEY_AGGREGATOR_TYPE = 'aggregator_type';
                              Severity: Minor
                              Found in src/module-elasticsuite-catalog-rule/Model/Data/Condition.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language