sequelize/sequelize

View on GitHub

Showing 787 of 787 total issues

Avoid deeply nested control flow statements.
Open

            if ($length === 1) {
              itemHash += stringify(row[`${prefix}.${primaryKeyAttributes[0]}`]);
            } else if ($length > 0) {
              for ($i = 0; $i < $length; $i++) {
                itemHash += stringify(row[`${prefix}.${primaryKeyAttributes[$i]}`]);
Severity: Major
Found in src/dialects/abstract/query.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (length) {
                  for (i = 0; i < length; i++) {
                    if (i === length - 1) {
                      values = $current[$keyPrefix[i]] = {};
                    }
    Severity: Major
    Found in src/dialects/abstract/query.js - About 45 mins to fix

      Function _whereGroupBind has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        _whereGroupBind(key, value, options) {
          const binding = key === Op.or ? this.OperatorMap[Op.or] : this.OperatorMap[Op.and];
          const outerBinding = key === Op.not ? 'NOT ' : '';
      
          if (Array.isArray(value)) {
      Severity: Minor
      Found in src/dialects/abstract/query-generator.js - About 45 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

      Avoid deeply nested control flow statements.
      Open

                    if (!item) {
                      item = previousModel.getAssociationForAlias(model, model.name);
                    }
      Severity: Major
      Found in src/dialects/abstract/query-generator.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  for ($i = 0; $i < uniqueKeyAttributes.length; $i++) {
                    topHash += row[uniqueKeyAttributes[$i]];
                  }
        Severity: Major
        Found in src/dialects/abstract/query.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if (Array.isArray(order)) {
                          order = order[0];
                        }
          Severity: Major
          Found in src/dialects/abstract/query-generator.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        for (let reverseIdx = newValuesBefore.length - 1; reverseIdx >= 0; reverseIdx--) {
                          if (~enumVals.indexOf(newValuesBefore[reverseIdx])) {
                            break;
                          }
            
            
            Severity: Major
            Found in src/dialects/postgres/query-interface.js - About 45 mins to fix

              Function whereItemsQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                whereItemsQuery(where, options, binding) {
                  if (where === null || where === undefined || Utils.getComplexSize(where) === 0) {
                    // NO OP
                    return '';
                  }
              Severity: Minor
              Found in src/dialects/abstract/query-generator.js - About 45 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

              Avoid deeply nested control flow statements.
              Open

                          if (newIdx > rightestPosition) {
                            rightestPosition = newIdx;
                          }
              Severity: Major
              Found in src/dialects/postgres/query-interface.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if (length) {
                              for (i = 0; i < length; i++) {
                                prefix = $parent ? `${$parent}.${$prevKeyPrefix[i]}` : $prevKeyPrefix[i];
                                primaryKeyAttributes = includeMap[prefix].model.primaryKeyAttributes;
                                $length = primaryKeyAttributes.length;
                Severity: Major
                Found in src/dialects/abstract/query.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (itemHash === topHash) {
                                if (!resultMap[itemHash]) {
                                  resultMap[itemHash] = values;
                                } else {
                                  topExists = true;
                  Severity: Major
                  Found in src/dialects/abstract/query.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                for (let reverseIdx = remainingEnumValues.length - 1; reverseIdx >= 0; reverseIdx--) {
                                  addEnumValue(field, remainingEnumValues[reverseIdx], lastOldEnumValue, 'after');
                                }
                    Severity: Major
                    Found in src/dialects/postgres/query-interface.js - About 45 mins to fix

                      Function handleSelectQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        handleSelectQuery(results) {
                          let result = null;
                      
                          // Map raw fields to names if a mapping is provided
                          if (this.options.fieldMap) {
                      Severity: Minor
                      Found in src/dialects/abstract/query.js - About 45 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 _loadDialectModule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _loadDialectModule(moduleName) {
                          try {
                            if (this.sequelize.config.dialectModulePath) {
                              return require(this.sequelize.config.dialectModulePath);
                            }
                      Severity: Minor
                      Found in src/dialects/abstract/connection-manager.js - About 45 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

                      Avoid deeply nested control flow statements.
                      Open

                                          for (const attr of Object.keys(include.association.through.model.rawAttributes)) {
                                            if (
                                              include.association.through.model.rawAttributes[attr]._autoGenerated ||
                                              attr === include.association.foreignKey ||
                                              attr === include.association.otherKey ||
                      Severity: Major
                      Found in src/model.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    if (!all.includes(types[j])) {
                                      all.unshift(types[j]);
                                      i++;
                                    }
                        Severity: Major
                        Found in src/model.js - About 45 mins to fix

                          Function constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                            constructor(values = {}, options = {}) {
                              options = {
                                isNewRecord: true,
                                _schema: this.constructor._schema,
                                _schemaDelimiter: this.constructor._schemaDelimiter,
                          Severity: Minor
                          Found in src/model.js - About 45 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 _addDefaultAttributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                            static _addDefaultAttributes() {
                              const tail = {};
                              let head = {};
                          
                              // Add id if no primary key was manually added to definition
                          Severity: Minor
                          Found in src/model.js - About 45 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

                          Avoid deeply nested control flow statements.
                          Open

                                      if (!parentHash) {
                                        parentHash = topHash;
                                      }
                          Severity: Major
                          Found in src/dialects/abstract/query.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if (dataType.includes(' REFERENCES')) {
                                          dataTypeString += dataType.substr(dataType.indexOf(' REFERENCES'));
                                        }
                            Severity: Major
                            Found in src/dialects/sqlite/query-generator.js - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language