Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

Function bindAttributeInputType has 51 lines of code (exceeds 40 allowed). Consider refactoring.
Open

                bindAttributeInputType: function () {
                    this.checkOptionsPanelVisibility();
                    this.switchDefaultValueField();

                    var filterableFrontendInputs = $.merge(this.selectFields, ['text', 'boolean']);

    Method getLanguageConfiguration has 51 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

        private function getLanguageConfiguration(\DOMXPath $xpath, $language, array $defaultConfig)
        {
            $languageCharFilters = $this->parseFilters(
                $xpath,
                self::CHAR_FILTER_TYPE_ROOT_NODE,
    Severity: Major
    Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.php - About 1 hr to fix

      Method build has 51 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)) {

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

            public function modifyData(array $data)
            {
                $optimizer = $this->locator->getOptimizer();
        
                if ($optimizer && $optimizer->getId() && isset($data[$optimizer->getId()])) {

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

            public function aroundExecute(
                \Magento\CatalogSearch\Controller\Result\Index $subject,
                \Closure $proceed
            ) {
                $result = $proceed();

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

            public function getInputType()
            {
                $inputType        = 'string';
                $selectAttributes = ['attribute_set_id'];
        
        

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

            public function modifyAttributes($storeId, $requestName, $attributes, $query, $filters, $queryFilters)
            {
                $relevantAttributes = [];
                $coverageRates      = $this->getCoverageRates($storeId, $requestName, $query, $filters, $queryFilters);
        
        

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

            private function getMetrics($rawValue)
            {
                $metrics = [];
        
                foreach ($rawValue as $metricName => $value) {

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

            protected function getGroupsForSave()
            {
                $groups = $this->getRequest()->getPost('groups');
                $files = $this->getRequest()->getFiles('groups');
        
        

        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

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

            public function execute()
            {
                /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
                $resultRedirect = $this->resultRedirectFactory->create();
        
        

        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

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