Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-tracker/Model/IndexManager.php

Summary

Maintainability
B
6 hrs
Test Coverage

Showing 7 of 7 total issues

Function migrateDailyToMonthlyIndices has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

public function migrateDailyToMonthlyIndices(): void
{
$indexIdentifiers = [SessionIndexInterface::INDEX_IDENTIFIER, EventIndexInterface::INDEX_IDENTIFIER];
 
foreach ($indexIdentifiers as $indexIdentifier) {
Severity: Minor
Found in src/module-elasticsuite-tracker/Model/IndexManager.php - About 2 hrs to fix

Function keepLatest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

public function keepLatest(int $number)
{
if ($number === 0) {
return;
}
Severity: Minor
Found in src/module-elasticsuite-tracker/Model/IndexManager.php - About 1 hr to fix

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

\Magento\Store\Model\StoreManagerInterface $storeManager,
\Smile\ElasticsuiteCore\Api\Index\IndexSettingsInterface $indexSettings,
\Smile\ElasticsuiteCore\Api\Client\ClientInterface $client,
\Smile\ElasticsuiteCore\Api\Index\IndexOperationInterface $indexOperation,
\Smile\ElasticsuiteTracker\Model\EventIndex\DateBounds $dateBounds,
Severity: Major
Found in src/module-elasticsuite-tracker/Model/IndexManager.php - About 50 mins to fix

    Function getIndicesToDelete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    protected function getIndicesToDelete(\DateTime $thresholdDate, array $indices, string $indexAlias): array
    {
    $indicesToDelete = [];
    foreach ($indices as $index) {
    $date = str_replace("{$indexAlias}_", '', $index);
    Severity: Minor
    Found in src/module-elasticsuite-tracker/Model/IndexManager.php - About 35 mins to fix

    Possibly zero references to use statement for classlike/namespace SessionIndex (\Smile\ElasticsuiteTracker\Model\ResourceModel\SessionIndex)
    Open

    use Smile\ElasticsuiteTracker\Model\ResourceModel\SessionIndex;

    Possibly zero references to use statement for classlike/namespace LoggerInterface (\Psr\Log\LoggerInterface)
    Open

    use Psr\Log\LoggerInterface;

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    public function __construct(
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Smile\ElasticsuiteCore\Api\Index\IndexSettingsInterface $indexSettings,
    \Smile\ElasticsuiteCore\Api\Client\ClientInterface $client,
    \Smile\ElasticsuiteCore\Api\Index\IndexOperationInterface $indexOperation,
    Severity: Major
    Found in src/module-elasticsuite-tracker/Model/IndexManager.php and 7 other locations - About 40 mins to fix
    src/module-elasticsuite-analytics/Model/Search/Usage/Terms/ConversionRatePostProcessor.php on lines 76..92
    src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Category.php on lines 95..111
    src/module-elasticsuite-catalog/Model/ProductSorter/AbstractPreview.php on lines 78..94
    src/module-elasticsuite-catalog/Plugin/Catalog/Eav/AttributePlugin.php on lines 115..131
    src/module-elasticsuite-catalog/Plugin/CatalogSearch/ResultPlugin.php on lines 90..106
    src/module-elasticsuite-core/Indexer/GenericIndexerHandler.php on lines 81..97
    src/module-elasticsuite-core/Search/Request/Query/Boolean.php on lines 76..92
    Category
    Status