Smile-SA/elasticsuite

View on GitHub

Showing 607 of 1,357 total issues

Index has 12 functions (exceeds 10 allowed). Consider refactoring.
Open

class Index
{
    /**
     * @var string
     */
Severity: Minor
Found in src/module-elasticsuite-thesaurus/Model/Index.php - About 2 hrs to fix

    File QueryBuilder.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * DISCLAIMER
     *
     * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer

      Function execute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute()
          {
              /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
              $resultRedirect = $this->resultRedirectFactory->create();
              $data = $this->getRequest()->getPostValue();

      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 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addData($storeId, array $indexData)
          {
              $productIds   = array_keys($indexData);
              $indexData    = $this->addAttributeData($storeId, $productIds, $indexData);
      
      

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

          public function updateSearchContext($args)
          {
              if (!empty($args['search'])) {
                  try {
                      $query = $this->queryFactory->create()->loadByQueryText($args['search']);

      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 fitWithPointLabels has 71 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

          function fitWithPointLabels(scale) {
              const furthestLimits = {
                  l: 0,
                  r: scale.width,
                  t: 0,
      Severity: Major
      Found in src/module-elasticsuite-core/view/adminhtml/web/js/lib/chart.js - About 2 hrs to fix

        QueryBuilder has 11 functions (exceeds 10 allowed). Consider refactoring.
        Open

        class QueryBuilder
        {
            /**
             * @var QueryFactory
             */

          ProductDate has 11 functions (exceeds 10 allowed). Consider refactoring.
          Open

          class ProductDate implements SpecialAttributeInterface
          {
              /**
               * @var string
               */

            Request has 11 functions (exceeds 10 allowed). Consider refactoring.
            Open

            class Request extends \Magento\Framework\Search\Request implements RequestInterface
            {
                /**
                 * @var SortOrderInterface
                 */
            Severity: Minor
            Found in src/module-elasticsuite-core/Search/Request.php - About 2 hrs to fix

              Context has 11 functions (exceeds 10 allowed). Consider refactoring.
              Open

              class Context implements \Smile\ElasticsuiteCore\Api\Search\ContextInterface
              {
                  /**
                   * @var \Magento\Catalog\Api\Data\CategoryInterface
                   */
              Severity: Minor
              Found in src/module-elasticsuite-core/Search/Context.php - About 2 hrs to fix

                Thesaurus has 11 functions (exceeds 10 allowed). Consider refactoring.
                Open

                class Thesaurus extends AbstractEntity
                {
                    const ENTITY_CODE = 'thesaurus';
                    const COL_TERMS = 'terms_relations';
                    const COL_STORES = 'stores';
                Severity: Minor
                Found in src/module-elasticsuite-thesaurus/Model/Import/Thesaurus.php - About 2 hrs to fix

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

                          $minimumShouldMatch,
                          $tieBreaker,
                          $phraseMatchBoost,
                          $cutOffFrequency,
                          FuzzinessConfigurationInterface $fuzziness = null,

                    Function addOptionsData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function addOptionsData(array $items)
                        {
                            if ($this->getAttributeModel()->getFacetSortOrder() == BucketInterface::SORT_ORDER_MANUAL) {
                                $options = $this->getAttributeModel()->getFrontend()->getSelectOptions();
                                $optionPosition = 0;
                    Severity: Minor
                    Found in src/module-elasticsuite-catalog/Model/Layer/Filter/Attribute.php - About 2 hrs 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 _initItems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function _initItems()
                        {
                            parent::_initItems();
                    
                            foreach ($this->_items as $key => $item) {
                    Severity: Minor
                    Found in src/module-elasticsuite-catalog/Model/Layer/Filter/Boolean.php - About 2 hrs 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 getBucketValues has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getBucketValues($rawBucket)
                        {
                            $values = [];
                    
                            if (isset($rawBucket['sum_other_doc_count']) && $rawBucket['sum_other_doc_count'] > 0) {

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

                        private function addChildrenQueries($query, CategoryInterface $category, $excludedCategories = []): QueryInterface
                        {
                            $childrenCategories    = $this->getChildrenCategories($category, $excludedCategories);
                            $childrenCategoriesIds = [];
                    
                    
                    Severity: Minor
                    Found in src/module-elasticsuite-virtual-category/Model/Rule.php - About 2 hrs 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 handleNestedField has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function handleNestedField($eventData, $field)
                        {
                            $fieldPath = $field->getNestedPath();
                            if ($eventData->hasData($fieldPath)) {
                                $fieldName = $field->getNestedFieldName();

                    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 json2html has 65 lines of code (exceeds 40 allowed). Consider refactoring.
                    Open

                      function json2html(json, options) {
                        var html = '';
                        if (typeof json === 'string') {
                          // Escape tags and quotes
                          json = json

                      Consider simplifying this complex logical expression.
                      Open

                                  if (!options.childList && !options.attributes && !options.characterData ||
                      
                                      // 1.2
                                      options.attributeOldValue && !options.attributes ||
                      
                      
                      Severity: Critical
                      Found in src/module-elasticsuite-core/view/base/web/js/MutationObserver.js - About 2 hrs to fix

                        Method _initElement has 65 lines of code (exceeds 40 allowed). Consider refactoring.
                        Open

                            protected function _initElement(
                                \Magento\Config\Model\Config\Structure\Element\Field $field,
                                \Magento\Framework\Data\Form\Element\Fieldset $fieldset,
                                $path,
                                $fieldPrefix = '',
                          Severity
                          Category
                          Status
                          Source
                          Language