Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

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

        Context $context,
        Registry $registry,
        FormFactory             $formFactory,
        TimezoneInterface       $localeDate,
        CombineConditionFactory $combineConditionsFactory,
Severity: Major
Found in src/module-elasticsuite-virtual-category/Model/Rule.php - About 2 hrs to fix

    Function _refreshValue has 64 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

            _refreshValue: function () {
                var lastValPercent, valPercent, value, valueMin, valueMax,
                    oRange = this.options.range,
                    o = this.options,
                    that = this,
    Severity: Major
    Found in src/module-elasticsuite-catalog/view/frontend/web/js/slider.js - About 1 hr to fix

      Function _drawColorBox has 63 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

              _drawColorBox(ctx, pt, i, rtlHelper, options) {
                  const me = this;
                  const labelColors = me.labelColors[i];
                  const labelPointStyle = me.labelPointStyles[i];
                  const {boxHeight, boxWidth} = options;
      Severity: Major
      Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

        Function getSearchQuery has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getSearchQuery(ProductCondition $productCondition)
            {
                $query = null;
        
                $query = $this->getSpecialAttributesSearchQuery($productCondition);

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

            public function saveIndex($dimensions, \Traversable $documents)
            {
                foreach ($dimensions as $dimension) {
                    $storeId   = $dimension->getValue();
        
        
        Severity: Minor
        Found in src/module-elasticsuite-core/Indexer/GenericIndexerHandler.php - About 1 hr 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 getItems has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getItems()
            {
                if ($this->items === null) {
                    $this->items = [];
        
        

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

            public function loadVariationByFallback(Product $parentProduct, array $attributes)
            {
                $variation = false;
        
                if ($this->isProductHasSwatch($parentProduct) && $parentProduct->getDocumentSource() !== null) {
        Severity: Minor
        Found in src/module-elasticsuite-swatches/Helper/Swatches.php - About 1 hr 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 handleEvent has 62 lines of code (exceeds 40 allowed). Consider refactoring.
        Open

                handleEvent: function(e) {
                    // Stop propagation since we are managing the propagation manually.
                    // This means that other mutation events on the page will not work
                    // correctly but that is by design.
                    e.stopImmediatePropagation();
        Severity: Major
        Found in src/module-elasticsuite-core/view/base/web/js/MutationObserver.js - About 1 hr to fix

          Method build has 61 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

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

            Method __construct has 14 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,

              Function getPropertyConfig has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getPropertyConfig($analyzer = self::ANALYZER_UNTOUCHED): array
                  {
                      $fieldMapping = ['type' => $this->getType()];
              
                      switch ($this->getType()) {
              Severity: Minor
              Found in src/module-elasticsuite-core/Index/Mapping/Field.php - About 1 hr 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 __construct has 14 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory,
                      \Magento\Store\Model\StoreManagerInterface $storeManager,
                      \Magento\Catalog\Model\Layer $layer,
                      \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder,
                      \Magento\Framework\Escaper $escaper,

                Function indexEvents has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function indexEvents($events)
                    {
                        $sessionIdsByStore = $this->getSessionIdsByStore($events);
                        $bulk              = $this->indexOperation->createBulk();
                        $indices           = [];
                Severity: Minor
                Found in src/module-elasticsuite-tracker/Model/SessionIndex.php - About 1 hr 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 __construct has 14 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        \Magento\Rule\Model\Condition\Context $context,
                        \Magento\Backend\Helper\Data $backendData,
                        \Magento\Eav\Model\Config $config,
                        \Smile\ElasticsuiteCatalogRule\Model\Rule\Condition\Product\AttributeList $attributeList,
                        \Smile\ElasticsuiteCatalogRule\Model\Rule\Condition\Product\QueryBuilder $queryBuilder,

                  Function update has 58 lines of code (exceeds 40 allowed). Consider refactoring.
                  Open

                          update(chart, width, height, minPadding) {
                              if (!chart) {
                                  return;
                              }
                              const padding = toPadding(chart.options.layout.padding);
                  Severity: Major
                  Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

                    Function keydown has 57 lines of code (exceeds 40 allowed). Consider refactoring.
                    Open

                                keydown: function (event) {
                                    var allowed, curVal, newVal, step,
                                        index = $(event.target).data("ui-slider-handle-index");
                    
                                    switch (event.keyCode) {
                    Severity: Major
                    Found in src/module-elasticsuite-catalog/view/frontend/web/js/slider.js - About 1 hr to fix

                      Function buildOrUpdateScales has 57 lines of code (exceeds 40 allowed). Consider refactoring.
                      Open

                              buildOrUpdateScales() {
                                  const me = this;
                                  const options = me.options;
                                  const scaleOpts = options.scales;
                                  const scales = me.scales;
                      Severity: Major
                      Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

                        Method postProcessResponse has 57 lines of code (exceeds 40 allowed). Consider refactoring.
                        Open

                            public function postProcessResponse($data)
                            {
                                $terms = array_keys($data);
                        
                                $storeId        = $this->context->getStoreId();

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

                                  Context $context,
                                  Data $backendData,
                                  Config $config,
                                  AttributeList $attributeList,
                                  QueryBuilder $queryBuilder,

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

                                    \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory,
                                    \Magento\Store\Model\StoreManagerInterface $storeManager,
                                    \Magento\Catalog\Model\Layer $layer,
                                    \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder,
                                    \Magento\Catalog\Model\ResourceModel\Layer\Filter\Price $resource,
                            Severity: Major
                            Found in src/module-elasticsuite-catalog/Model/Layer/Filter/Price.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language