sequelize/sequelize

View on GitHub

Showing 503 of 787 total issues

Function removeColumn has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async removeColumn(tableName, columnName, options) {
    options = options || {};

    const [results] = await this.sequelize.query(
      this.queryGenerator.getForeignKeyQuery(
Severity: Minor
Found in src/dialects/mysql/query-interface.js - About 1 hr to fix

    Function delete has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async delete(instance, tableName, identifier, options) {
        const cascades = [];
        const sql = this.queryGenerator.deleteQuery(tableName, identifier, {}, instance.constructor);
    
        options = { ...options };
    Severity: Minor
    Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

      Function has has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async has(sourceInstance, instances, options) {
          if (!Array.isArray(instances)) {
            instances = [instances];
          }
      
      
      Severity: Minor
      Found in src/associations/belongs-to-many.js - About 1 hr to fix

        Function changeColumnQuery has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          changeColumnQuery(tableName, attributes) {
            const attrString = [],
              constraintString = [];
            let commentString = '';
        
        
        Severity: Minor
        Found in src/dialects/mssql/query-generator.js - About 1 hr to fix

          Function normalizeAttribute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            normalizeAttribute(attribute) {
              if (!_.isPlainObject(attribute)) {
                attribute = { type: attribute };
              }
          
          
          Severity: Minor
          Found in src/sequelize.js - About 1 hr to fix

            Function formatBindParameters has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static formatBindParameters(sql, values, dialect) {
                const stringReplaceFunc = value => (typeof value === 'string' ? value.replace(/\0/g, '\\0') : value);
            
                let bindParam;
                if (Array.isArray(values)) {
            Severity: Minor
            Found in src/dialects/postgres/query.js - About 1 hr to fix

              Function createTable has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async createTable(tableName, attributes, options, model) {
                  let sql = '';
              
                  options = { ...options };
              
              
              Severity: Minor
              Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

                Function removeColumnQuery has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  removeColumnQuery(tableName, attributes) {
                    attributes = this.attributesToSQL(attributes);
                
                    let backupTableName;
                    if (typeof tableName === 'object') {
                Severity: Minor
                Found in src/dialects/sqlite/query-generator.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                        if (
                          (!options || (options && !options.raw)) &&
                          !(value instanceof Date) &&
                          !!value &&
                          value !== Infinity &&
                  Severity: Major
                  Found in src/dialects/postgres/data-types.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                          if (
                            options.raw &&
                            !(this._options && this._options.include) &&
                            !(options && options.attributes) &&
                            !this.constructor._hasDateAttributes &&
                    Severity: Major
                    Found in src/model.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                            if (
                              !options.raw &&
                              // True when sequelize method
                              (value instanceof Utils.SequelizeMethod ||
                              // Check for data type type comparators
                      Severity: Major
                      Found in src/model.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                      if (
                                        !!constraintName &&
                                        foreignKeyReference.tableCatalog === database &&
                                        (schema ? foreignKeyReference.tableSchema === schema : true) &&
                                        foreignKeyReference.referencedTableName === references.model &&
                        Severity: Major
                        Found in src/model.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                if (
                                  options.attributes &&
                                  !options.raw &&
                                  this.primaryKeyAttribute &&
                                  !options.attributes.includes(this.primaryKeyAttribute) &&
                          Severity: Major
                          Found in src/model.js - About 1 hr to fix

                            Function bulkInsertQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              bulkInsertQuery(tableName, attrValueHashes, options, attributes) {
                                const quotedTable = this.quoteTable(tableName);
                                options = options || {};
                                attributes = attributes || {};
                            
                            
                            Severity: Minor
                            Found in src/dialects/mssql/query-generator.js - About 55 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 removeHook has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              removeHook(hookType, name) {
                                const isReference = typeof name === 'function' ? true : false;
                            
                                if (!this.hasHook(hookType)) {
                                  return this;
                            Severity: Minor
                            Found in src/hooks.js - About 55 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 _logQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              _logQuery(sql, debugContext, parameters) {
                                const { connection, options } = this;
                                const benchmark = this.sequelize.options.benchmark || options.benchmark;
                                const logQueryParameters = this.sequelize.options.logQueryParameters || options.logQueryParameters;
                                const startTime = Date.now();
                            Severity: Minor
                            Found in src/dialects/abstract/query.js - About 55 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 formatBindParameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              static formatBindParameters(sql, values, dialect, replacementFunc, options) {
                                if (!values) {
                                  return [sql, []];
                                }
                            
                            
                            Severity: Minor
                            Found in src/dialects/abstract/query.js - About 55 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 createTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async createTable(tableName, attributes, options, model) {
                                let sql = '';
                            
                                options = { ...options };
                            
                            
                            Severity: Minor
                            Found in src/dialects/abstract/query-interface.js - About 55 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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async create(sourceInstance, values, options = {}) {
                                if (Array.isArray(options)) {
                                  options = {
                                    fields: options
                                  };
                            Severity: Minor
                            Found in src/associations/has-many.js - About 55 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 constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              constructor(
                                message: string,
                                type?: keyof typeof Origins | string,
                                path?: string,
                                value?: string,
                            Severity: Minor
                            Found in src/errors/validation-error.ts - About 55 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

                            Severity
                            Category
                            Status
                            Source
                            Language