Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

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

        constructor(item, config) {
            const me = this;
            this.config = config = new Config(config);
            const initialCanvas = getCanvas(item);
            const existingChart = getChart(initialCanvas);
Severity: Major
Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

    Function beforeElementsUpdate has 54 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

            beforeElementsUpdate: (chart, args, options) => {
                if (!options.enabled) {
                    cleanDecimatedData(chart);
                    return;
                }
    Severity: Major
    Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

      Method afterCreateCollection has 53 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

          public function afterCreateCollection(ProductsList $subject, $collection)
          {
              $storeId    = $this->getCurrentStoreId($subject);
              $sortOption = $subject->getData('sort_order');
              $conditionOption = $subject->getData('condition_option');

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

                $name,
                $indexName,
                QueryInterface $query,
                QueryInterface $filter = null,
                array $sortOrders = null,
        Severity: Major
        Found in src/module-elasticsuite-core/Search/Request.php - About 1 hr to fix

          Function getDataSets has 52 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

                  getDataSets: function (optionValue) {
                      optionValue =  this.currentOptionValue;
                      var datasets = [];
                      var DataSetsConfig =  {
                          'ln1p': {

            Function success has 52 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                                success: $.proxy(function (data) {
                                    var self = this;
                                    var lastElement = false;
                                    var content = this._getResultWrapper();
                                    var sectionDropdown = this._getSectionHeader();
            Severity: Major
            Found in src/module-elasticsuite-core/view/frontend/web/js/form-mini.js - About 1 hr to fix

              Method addFacetFields has 52 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                  private function addFacetFields(Fieldset $fieldset)
                  {
                      $fieldset->addField(
                          'facet_min_coverage_rate',
                          'text',

                Method execute has 52 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                    public function execute()
                    {
                        // Prepare product attributes grid collection.
                        $attributeCollectionFactory = $this->attributeCollectionFactory->create();
                        $attributeCollection = $attributeCollectionFactory->addVisibleFilter()

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

                      function minMaxDecimation(data, start, count, availableWidth) {
                          let avgX = 0;
                          let countX = 0;
                          let i, point, x, y, prevX, minIndex, maxIndex, startIndex, minY, maxY;
                          const decimated = [];
                  Severity: Major
                  Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

                    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']);

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

                          function getTooltipSize(tooltip, options) {
                              const ctx = tooltip._chart.ctx;
                              const {body, footer, title} = tooltip;
                              const {boxWidth, boxHeight} = options;
                              const bodyFont = toFont(options.bodyFont);
                      Severity: Major
                      Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

                        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 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 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 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 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 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 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

                            Severity
                            Category
                            Status
                            Source
                            Language