Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-core/Index/Indices/Config.php

Summary

Maintainability
A
1 hr
Test Coverage

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

        Reader $reader,
        CacheInterface $cache,
        MappingFactory $mappingFactory,
        MappingFieldFactory $mappingFieldFactory,
        DataSourceResolverFactory $dataSourceResolverFactory,
Severity: Major
Found in src/module-elasticsuite-core/Index/Indices/Config.php - About 50 mins to fix

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

        private function getDynamicFields($indexName)
        {
            $fields       = [];
            $cacheId      = implode('|', [$this->cacheId, $indexName]);
            $fieldsConfig = $this->cache->load($cacheId);
    Severity: Minor
    Found in src/module-elasticsuite-core/Index/Indices/Config.php - About 35 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

    Suspicious array access to float|int
    Open

                $fields[$fieldName] = $this->mappingFieldFactory->create(['name' => $fieldName] + $fieldConfig);

    Possibly zero references to use statement for classlike/namespace TypeFactory (\Smile\ElasticsuiteCore\Api\Index\TypeInterfaceFactory)
    Open

    use Smile\ElasticsuiteCore\Api\Index\TypeInterfaceFactory as TypeFactory;

    float|int passed to foreach instead of array
    Open

                foreach ($fields as $fieldName => $field) {

    There are no issues that match your filters.

    Category
    Status