Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

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

    public function indexEvents($events)
    {
        $bulk    = $this->indexOperation->createBulk();
        $indices = [];

Severity: Minor
Found in src/module-elasticsuite-tracker/Model/EventIndex.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 getSynonymRewrites has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function getSynonymRewrites($storeId, $queryText, $type, $maxRewrites)
    {
        $indexName        = $this->getIndexAlias($storeId);
        $analyzedQueries  = $this->getQueryCombinations($storeId, str_replace('-', ' ', $queryText));
        $synonyms         = [];
Severity: Minor
Found in src/module-elasticsuite-thesaurus/Model/Index.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 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

        OptimizerInterface $optimizer,
        Preview\ItemFactory $previewItemFactory,
        ApplierListFactory $applierListFactory,
        Functions\ProviderFactory $providerFactory,
        ContainerConfigurationInterface $containerConfig,

    Method __construct has 11 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,
    Severity: Major
    Found in src/module-elasticsuite-catalog/Model/Layer/Filter/Category.php - About 1 hr to fix

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

              $name,
              $field,
              array $metrics = [],
              array $childBuckets = [],
              array $pipelines = [],

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

                $name,
                $field,
                array $metrics = [],
                array $childBuckets = [],
                array $pipelines = [],

          Function renderText has 49 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

              function renderText(ctx, text, x, y, font, opts = {}) {
                  const lines = isArray(text) ? text : [text];
                  const stroke = opts.strokeWidth > 0 && opts.strokeColor !== '';
                  let i, line;
                  ctx.save();
          Severity: Minor
          Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

            Function _setOption has 49 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                    _setOption: function (key, value) {
                        var i,
                            valsLength = 0;
            
                        if (key === "range" && this.options.range === true) {
            Severity: Minor
            Found in src/module-elasticsuite-catalog/view/frontend/web/js/slider.js - About 1 hr to fix

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

                      update(maxWidth, maxHeight, margins) {
                          const me = this;
                          const tickOpts = me.options.ticks;
                          const sampleSize = tickOpts.sampleSize;
                          me.beforeUpdate();
              Severity: Minor
              Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

                Method prepareAdaptiveIntervals has 49 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                    private function prepareAdaptiveIntervals(): array
                    {
                        $adaptiveIntervals = [];
                        $intervals = $this->getIntervals();
                
                

                  Function _mouseCapture has 48 lines of code (exceeds 40 allowed). Consider refactoring.
                  Open

                          _mouseCapture: function (event) {
                              var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
                                  that = this,
                                  o = this.options;
                  
                  
                  Severity: Minor
                  Found in src/module-elasticsuite-catalog/view/frontend/web/js/slider.js - About 1 hr to fix

                    Function constructor has 48 lines of code (exceeds 40 allowed). Consider refactoring.
                    Open

                            constructor(cfg) {
                                super();
                                this.id = cfg.id;
                                this.type = cfg.type;
                                this.options = undefined;
                    Severity: Minor
                    Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

                      Method addData has 47 lines of code (exceeds 40 allowed). Consider refactoring.
                      Open

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

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

                            public function build(AggregationInterface $aggregation, ?int $storeId): array
                            {
                                $bucket = $aggregation->getBucket(self::CATEGORY_BUCKET);
                        
                                if ($this->isBucketEmpty($bucket)) {

                          Method addChildrenQueries has 47 lines of code (exceeds 40 allowed). Consider refactoring.
                          Open

                              private function addChildrenQueries($query, CategoryInterface $category, $excludedCategories = []): QueryInterface
                              {
                                  $childrenCategories    = $this->getChildrenCategories($category, $excludedCategories);
                                  $childrenCategoriesIds = [];
                          
                          
                          Severity: Minor
                          Found in src/module-elasticsuite-virtual-category/Model/Rule.php - About 1 hr to fix

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

                                    Context $context,
                                    PreviewFactory $previewModelFactory,
                                    CategoryRepositoryInterface $categoryRepository,
                                    OptimizerInterfaceFactory $optimizerFactory,
                                    ContainerConfigurationFactory $containerConfigFactory,

                              Function getQueryIdsLimitation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function getQueryIdsLimitation($entity)
                                  {
                                      $searchContainerData = $entity->getData('quick_search_container');
                                      $applyTo  = is_array($searchContainerData) ? ((bool) $searchContainerData['apply_to'] ?? false) : false;
                                      $queryIds = [];

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

                                      CollectionEntityFactory $entityFactory,
                                      LoggerInterface $logger,
                                      FetchStrategyInterface $fetchStrategy,
                                      ManagerInterface $eventManager,
                                      Config $eavConfig,

                                Method __construct has 10 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\DecimalFactory $filterDecimalFactory,
                                Severity: Major
                                Found in src/module-elasticsuite-catalog/Model/Layer/Filter/Decimal.php - About 1 hr to fix

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

                                          ItemFactory $filterItemFactory,
                                          StoreManagerInterface $storeManager,
                                          Layer $layer,
                                          DataBuilder $itemDataBuilder,
                                          StripTags $tagFilter,
                                  Severity: Major
                                  Found in src/module-elasticsuite-catalog/Model/Layer/Filter/Boolean.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language