Smile-SA/elasticsuite

View on GitHub

Showing 620 of 1,375 total issues

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

    public function getFieldType($attributeId)
    {
        // Backward compatibility.
        if (!is_numeric($attributeId)) {
            $attributeId = $this->getAttributeId($attributeId);
Severity: Minor
Found in src/module-elasticsuite-catalog/Helper/AbstractAttribute.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 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 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 getWeightedSearchProperties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getWeightedSearchProperties(
        $analyzer = null,
        $defaultField = null,
        $boost = 1,
        FieldFilterInterface $fieldFilter = null
Severity: Minor
Found in src/module-elasticsuite-core/Index/Mapping.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 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

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

    private function getSubAggregations($rawValue)
    {
        $subAggregations = [];

        foreach ($rawValue as $key => $value) {

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

    public function checkAndFixData(int $storeId): array
    {
        $data = [];

        foreach ($this->checkers as &$checker) {
Severity: Minor
Found in src/module-elasticsuite-tracker/Model/Data/Checker.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 getData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getData($key = '', $index = null)
    {
        if ('' === $key) {
            return $this->_data;
        }
Severity: Minor
Found in src/module-elasticsuite-tracker/Model/Event/DotObject.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 getCategorySearchQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCategorySearchQuery($category, $excludedCategories = []): ?QueryInterface
    {
        \Magento\Framework\Profiler::start('ES:Virtual Rule ' . __FUNCTION__);
        $categoryId = (int) (!is_object($category) ? $category : $category->getId());
        $storeId = !is_object($category) ? $this->getStoreId() : $category->getStoreId();
Severity: Minor
Found in src/module-elasticsuite-virtual-category/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 build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function build(AggregationInterface $aggregation, ?int $storeId): array
    {
        $bucket = $aggregation->getBucket(self::CATEGORY_BUCKET);

        if ($this->isBucketEmpty($bucket)) {

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

    private function deleteThesaurus(): bool
    {
        $rows = [];
        while ($bunch = $this->_dataSourceModel->getNextBunch()) {
            foreach ($bunch as $rowNum => $rowData) {
Severity: Minor
Found in src/module-elasticsuite-thesaurus/Model/Import/Thesaurus.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 drawBody has 42 lines of code (exceeds 40 allowed). Consider refactoring.
Open

        drawBody(pt, ctx, options) {
            const me = this;
            const {body} = me;
            const {bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth} = options;
            const bodyFont = toFont(options.bodyFont);
Severity: Minor
Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix

    Function _computeLabelSizes has 42 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

            _computeLabelSizes(ticks, length) {
                const {ctx, _longestTextCache: caches} = this;
                const widths = [];
                const heights = [];
                let widestLabelSize = 0;
    Severity: Minor
    Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language