Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

Function buildBucket has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildBucket(BucketInterface $bucket)
    {
        if ($bucket->getType() !== BucketInterface::TYPE_TERM) {
            throw new \InvalidArgumentException("Query builder : invalid aggregation type {$bucket->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 parseTermVectors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function parseTermVectors($termVectors, $cutoffFrequencyLimit, $useAllTokens = false)
    {
        $queryTermStats = ['stop' => 0, 'exact' => 0, 'standard' => 0, 'missing' => 0];
        $statByPosition = $this->extractTermStatsByPosition($termVectors, $useAllTokens);

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

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

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

    private function getLayerVariables()
    {
        $variables = [];
        $layer     = $this->catalogLayer;

Severity: Minor
Found in src/module-elasticsuite-tracker/Block/Variables/Page/Catalog.php - About 55 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 getCategorySearchQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function getCategorySearchQuery($excludedCategories): ?QueryInterface
    {
        $categoryIds = [];
        $subQueries  = [];
        $valueArray  = $this->getValue();

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

    public function postProcessResponse($data)
    {
        $terms = array_keys($data);

        $storeId        = $this->context->getStoreId();

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

    private function combineSynonyms($queryText, $synonymByPositions, $maxRewrites, $substitutions = 0, $offset = 0)
    {
        $combinations = [];

        if (!empty($synonymByPositions) && $substitutions < $maxRewrites) {
Severity: Minor
Found in src/module-elasticsuite-thesaurus/Model/Index.php - About 55 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 deleteThesaurusFinish has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function deleteThesaurusFinish(array $thesaurusIds): bool
    {
        if ($thesaurusIds) {
            try {
                foreach ($thesaurusIds as $thesaurusId) {
Severity: Minor
Found in src/module-elasticsuite-thesaurus/Model/Import/Thesaurus.php - About 55 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 buildCategorySearchQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildCategorySearchQuery($category, $excludedCategories = []): ?QueryInterface
    {
        $query = null;

        if (!in_array($category->getId(), $excludedCategories)) {
Severity: Minor
Found in src/module-elasticsuite-virtual-category/Model/Rule.php - About 55 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 loadVariationsFromSearchIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadVariationsFromSearchIndex(Product $parentProduct, array $attributes)
    {
        $documentSource = $parentProduct->getDocumentSource();
        $childrenIds    = isset($documentSource['children_ids']) ? $documentSource['children_ids'] : [];
        $variation      = false;
Severity: Minor
Found in src/module-elasticsuite-swatches/Helper/Swatches.php - About 55 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

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

        \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Framework\Stdlib\DateTime\DateTime $date,

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

            ProductCollectionFactory $collectionFactory,
            ItemDataFactory $itemFactory,
            QueryFactory $queryFactory,
            $storeId,
            $size = 10,
    Severity: Major
    Found in src/module-elasticsuite-catalog/Model/ProductSorter/AbstractPreview.php - About 50 mins to fix

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

              \Magento\Framework\View\Element\Template\Context $context,
              \Magento\Catalog\Model\Layer\Resolver $layerResolver,
              \Magento\Catalog\Model\Layer\FilterList $filterList,
              \Magento\Catalog\Model\Layer\AvailabilityFlagInterface $visibilityFlag,
              \Magento\Framework\ObjectManagerInterface $objectManager,
      Severity: Major
      Found in src/module-elasticsuite-catalog/Block/Navigation.php - About 50 mins to fix

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

                ContextInterface $context,
                UiComponentFactory $uiComponentFactory,
                UrlInterface $urlBuilder,
                array $components = [],
                array $data = [],

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

                  \Smile\ElasticsuiteCore\Index\Indices\Config $indicesConfig,
                  IndexerRegistry $indexerRegistry,
                  StoreManagerInterface $storeManager,
                  IndexOperationInterface $indexOperation,
                  AttributeHelper $attributeHelper,
          Severity: Major
          Found in src/module-elasticsuite-catalog/Plugin/Catalog/Eav/AttributePlugin.php - About 50 mins to fix

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

                    \Magento\Framework\Model\Context $context,
                    \Magento\Framework\Registry $registry,
                    \Magento\Framework\Data\FormFactory $formFactory,
                    \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
                    \Smile\ElasticsuiteCatalogRule\Model\Rule\Condition\CombineFactory $conditionsFactory,
            Severity: Major
            Found in src/module-elasticsuite-catalog-rule/Model/Rule.php - About 50 mins to fix

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

                      $name,
                      $primaryFieldName,
                      $requestFieldName,
                      OptimizerCollectionFactory $optimizerCollectionFactory,
                      PoolInterface $modifierPool,

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

                        Resolver $layerResolver,
                        ScopeConfigInterface $scopeConfig,
                        Data $catalogSearchHelper,
                        ManagerInterface $messageManager,
                        ResultFactory $resultFactory,
                Severity: Major
                Found in src/module-elasticsuite-catalog/Plugin/CatalogSearch/ResultPlugin.php - About 50 mins to fix

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

                          IndexOperationInterface $indexOperation,
                          CacheHelper $cacheHelper,
                          Batch $batch,
                          DataSourceResolverInterfaceFactory $dataSourceResolverFactory,
                          IndexSettingsInterface $indexSettings,
                  Severity: Major
                  Found in src/module-elasticsuite-core/Indexer/GenericIndexerHandler.php - About 50 mins to fix

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

                            array $must = [],
                            array $should = [],
                            array $mustNot = [],
                            $minimumShouldMatch = 1,
                            $name = null,
                    Severity: Major
                    Found in src/module-elasticsuite-core/Search/Request/Query/Boolean.php - About 50 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language