Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

Function fastPathSegment has 43 lines of code (exceeds 40 allowed). Consider refactoring.
Open

    function fastPathSegment(ctx, line, segment, params) {
        const points = line.points;
        const {count, start, ilen} = pathVars(points, segment, params);
        const {move = true, reverse} = params || {};
        let avgX = 0;
Severity: Minor
Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

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

            update(mode) {
                const me = this;
                const config = me.config;
                config.update();
                me._options = config.createResolver(config.chartOptionScopes(), me.getContext());
    Severity: Minor
    Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

      Function _mouseDown has 43 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

              _mouseDown: function( event ) {
      
                  // don't let more than one widget handle mouseStart
                  if ( mouseHandled ) {
                      return;
      Severity: Minor
      Found in src/module-elasticsuite-catalog/view/frontend/web/js/mouse.js - About 1 hr to fix

        Function _getYAxisLabelAlignment has 43 lines of code (exceeds 40 allowed). Consider refactoring.
        Open

                _getYAxisLabelAlignment(tl) {
                    const me = this;
                    const {position, ticks: {crossAlign, mirror, padding}} = me.options;
                    const labelSizes = me._getLabelSizes();
                    const tickAndPadding = tl + padding;
        Severity: Minor
        Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

          Method checkUpdateNeeded has 43 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

              private function checkUpdateNeeded($subject)
              {
                  $updateMapping = $cleanCache = $invalidateIndex = false;
          
                  if ($this->saveIsNew === true) {

            Method parseAnalyzers has 43 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                private function parseAnalyzers(
                    \DOMXPath $xpath,
                    array $availableCharFilters,
                    array $availableFilters,
                    $language = self::LANGUAGE_DEFAULT,
            Severity: Minor
            Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.php - About 1 hr to fix

              Method getSuggestions has 43 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                  private function getSuggestions(string $queryText, int $maxSize = self::MAX_COUNT)
                  {
                      $suggestions     = [];
                      $containerConfig = $this->getRequestContainerConfiguration(
                          $this->storeManager->getStore()->getId(),
              Severity: Minor
              Found in src/module-elasticsuite-core/Model/DataProvider/Suggestions.php - About 1 hr to fix

                Method getSpanQuery has 43 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                    private function getSpanQuery(ContainerConfigurationInterface $containerConfig, $queryText, $boost)
                    {
                        $query = null;
                        $terms = explode(' ', $queryText);
                
                

                  Function getSearchQueryIdentities has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getSearchQueryIdentities()
                      {
                          $identities = [];
                          $queryIds   = [];
                          $origData   = $this->optimizer->getOrigData();

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

                      protected function arrayToConditionDataModel(array $input)
                      {
                          /** @var \Smile\ElasticsuiteCatalogRule\Model\Data\Condition $conditionDataModel */
                          $conditionDataModel = $this->conditionDataFactory->create();
                          foreach ($input as $key => $value) {
                  Severity: Minor
                  Found in src/module-elasticsuite-catalog-rule/Model/Rule.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 apply has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function apply(\Magento\Framework\App\RequestInterface $request)
                      {
                          /**
                           * Filter must be string: $fromPrice-$toPrice
                           */

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

                      protected function _getItemsData()
                      {
                          $attribute = $this->getAttributeModel();
                          $this->_requestVar = $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 addData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function addData($storeId, array $indexData): array
                      {
                          $categoryData = $this->resourceModel->loadCategoryData($storeId, array_keys($indexData));
                  
                          foreach ($categoryData as $categoryDataRow) {

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

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

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

                      public function addFieldsToFilter($fields)
                      {
                          if ($fields) {
                              foreach ($fields as $fieldByType) {
                                  foreach ($fieldByType as $attributeId => $condition) {

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

                      public function loadData($printQuery = false, $logQuery = false): Collection
                      {
                          /** @var IndexerCollection $collection */
                          $collection = $this->collectionFactory->create();
                          $indexers = $collection->getItems();

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

                      public function validateRow(array $rowData, $rowNum)
                      {
                          $errors = [];
                  
                          // Validate if attribute exists.
                  Severity: Minor
                  Found in src/module-elasticsuite-catalog/Model/Import/ProductAttribute.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 parseFilters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function parseFilters(\DOMXPath $xpath, $rootNodeName, $nodeName, $language = self::LANGUAGE_DEFAULT)
                      {
                          $filters = [];
                          $languagePath = sprintf("[@language='%s']", $language);
                          $searchPath   = sprintf("/%s/%s/%s%s", self::ROOT_NODE_NAME, $rootNodeName, $nodeName, $languagePath);
                  Severity: Minor
                  Found in src/module-elasticsuite-core/Index/Analysis/Config/Converter.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 configure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function configure(array $inputOptions)
                      {
                          foreach ($inputOptions as $inputKey => $inputValue) {
                              if (null !== $inputValue && (isset($this->searchConfigMapping[$inputKey]))) {
                                  $configKey = $this->searchConfigMapping[$inputKey];
                  Severity: Minor
                  Found in src/module-elasticsuite-core/Setup/InstallConfig.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 prepareCondition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function prepareCondition($condition)
                      {
                          if (!is_array($condition)) {
                              $condition = ['in' => [$condition]];
                          }

                  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