Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

Avoid too many return statements within this method.
Open

                return $resultRedirect->setPath('*/*/');

    Avoid too many return statements within this method.
    Open

            return $resultRedirect->setPath('*/*/index');

      Avoid too many return statements within this method.
      Open

              return array_key_exists(array_shift($keys), $array);
      Severity: Minor
      Found in src/module-elasticsuite-tracker/Model/Event/DotObject.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $filters;
        Severity: Minor
        Found in src/module-elasticsuite-catalog-graph-ql/Model/Resolver/Aggregations.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $resultRedirect->setPath('*/*/');

            Avoid too many return statements within this method.
            Open

                    return $resultRedirect->setPath('*/*/index');

              Avoid too many return statements within this method.
              Open

                          return $this->actionFactory->create('Magento\Framework\App\Action\Forward');
              Severity: Minor
              Found in src/module-elasticsuite-virtual-category/Controller/Router.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $items;

                  Avoid too many return statements within this method.
                  Open

                          return ['category_uid' => $result];

                    Avoid too many return statements within this method.
                    Open

                            return $action;
                    Severity: Minor
                    Found in src/module-elasticsuite-virtual-category/Controller/Router.php - About 30 mins to fix

                      Function getProductPrice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getProductPrice()
                          {
                              $price    = 0;
                              $document = $this->getDocumentSource();
                      
                      

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

                          private function parseDateFields()
                          {
                              if ('' === $this->getFromDate()) {
                                  $this->unsFromDate();
                              }
                      Severity: Minor
                      Found in src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php - About 25 mins 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 setSortParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function setSortParams(
                              \Magento\Catalog\Model\Layer $layer,
                              \Magento\Catalog\Model\ResourceModel\Collection\AbstractCollection $collection
                          ) {
                              $searchQuery = $this->queryFactory->get();
                      Severity: Minor
                      Found in src/module-elasticsuite-catalog/Plugin/LayerPlugin.php - About 25 mins 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 addIndexedFilterToAttributeCollection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function addIndexedFilterToAttributeCollection(AttributeCollection $attributeCollection)
                          {
                              $conditions = [];
                      
                              foreach ($this->indexedAttributesConditions as $fieldName => $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 prepareDataSource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function prepareDataSource(array $dataSource)
                          {
                              if (isset($dataSource['data']['items'])) {
                                  foreach ($dataSource['data']['items'] as & $item) {
                                      $name = $this->getData('name');

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

                          private function addProductData($data)
                          {
                              $product = $data['product'];
                      
                              $productData = [

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

                          private function isRebuilding(string $indexName, $indexDate): bool
                          {
                              if (!empty($this->workingIndexers)) {
                                  foreach (array_keys($this->workingIndexers) as $indexKey) {
                                      if (strpos((string) $indexName, $indexKey) !== false) {
                      Severity: Minor
                      Found in src/module-elasticsuite-indices/Model/IndexStatusProvider.php - About 25 mins 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 buildRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function buildRow($item, $fields)
                          {
                              // Remove position for not pinned items.
                              if (empty($item['is_pinned']) || filter_var($item['is_pinned'], FILTER_VALIDATE_BOOLEAN) === false) {
                                  $item['position'] = null;

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

                          private function addAttributeData($storeId, $productIds, $indexData = [])
                          {
                              foreach ($this->attributeIdsByTable as $backendTable => $attributeIds) {
                                  $attributesData = $this->loadAttributesRawData($storeId, $productIds, $backendTable, $attributeIds);
                                  foreach ($attributesData as $row) {

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

                          private function loadProductCounts(): void
                          {
                              $storeId     = $this->getStoreId();
                              $requestName = $this->searchRequestName;
                              $facets = [

                      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