sequelize/sequelize

View on GitHub

Showing 446 of 804 total issues

File model.js has 2557 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const assert = require('assert');
const _ = require('lodash');
const Dottie = require('dottie');
Severity: Major
Found in lib/model.js - About 1 wk to fix

    File query-generator.js has 1919 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    const util = require('util');
    const _ = require('lodash');
    const uuidv4 = require('uuid/v4');
    Severity: Major
    Found in lib/dialects/abstract/query-generator.js - About 5 days to fix

      Function _groupJoinData has a Cognitive Complexity of 251 (exceeds 5 allowed). Consider refactoring.
      Open

        static _groupJoinData(rows, includeOptions, options) {
      
          /*
           * Assumptions
           * ID is not necessarily the first field
      Severity: Minor
      Found in lib/dialects/abstract/query.js - About 5 days 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 exports has a Cognitive Complexity of 186 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = BaseTypes => {
        const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'http://www.postgresql.org/docs/9.4/static/datatype.html');
      
        /**
         * Removes unsupported Postgres options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
      Severity: Minor
      Found in lib/dialects/postgres/data-types.js - About 3 days 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 exports has 475 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = BaseTypes => {
        const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'http://www.postgresql.org/docs/9.4/static/datatype.html');
      
        /**
         * Removes unsupported Postgres options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
      Severity: Major
      Found in lib/dialects/postgres/data-types.js - About 2 days to fix

        Function selectQuery has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring.
        Open

          selectQuery(tableName, options, model) {
            options = options || {};
            const limit = options.limit;
            const mainQueryItems = [];
            const subQueryItems = [];
        Severity: Minor
        Found in lib/dialects/abstract/query-generator.js - About 2 days 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

        Model has 93 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Model {
          static get QueryInterface() {
            return this.sequelize.getQueryInterface();
          }
        
        
        Severity: Major
        Found in lib/model.js - About 1 day to fix

          Function set has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
          Open

            set(key, value, options) { // testhint options:none
              let values;
              let originalValue;
          
              if (typeof key === 'object' && key !== null) {
          Severity: Minor
          Found in lib/model.js - About 1 day 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

          File query-interface.js has 712 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          const _ = require('lodash');
          
          const Utils = require('./utils');
          Severity: Major
          Found in lib/query-interface.js - About 1 day to fix

            File data-types.js has 707 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            const util = require('util');
            const inherits = require('./utils/inherits');
            const _ = require('lodash');
            Severity: Major
            Found in lib/data-types.js - About 1 day to fix

              File query-generator.js has 685 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict';
              
              const _ = require('lodash');
              const Utils = require('../../utils');
              const DataTypes = require('../../data-types');
              Severity: Major
              Found in lib/dialects/mssql/query-generator.js - About 1 day to fix

                File query-generator.js has 676 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                const Utils = require('../../utils');
                const util = require('util');
                const DataTypes = require('../../data-types');
                Severity: Major
                Found in lib/dialects/postgres/query-generator.js - About 1 day to fix

                  Function generateInclude has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
                  Open

                    generateInclude(include, parentTableName, topLevelInfo) {
                      const joinQueries = {
                        mainQuery: [],
                        subQuery: []
                      };
                  Severity: Minor
                  Found in lib/dialects/abstract/query-generator.js - About 1 day 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 _groupJoinData has 271 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static _groupJoinData(rows, includeOptions, options) {
                  
                      /*
                       * Assumptions
                       * ID is not necessarily the first field
                  Severity: Major
                  Found in lib/dialects/abstract/query.js - About 1 day to fix

                    Function insertQuery has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                    Open

                      insertQuery(table, valueHash, modelAttributes, options) {
                        options = options || {};
                        _.defaults(options, this.options);
                    
                        const modelAttributeMap = {};
                    Severity: Minor
                    Found in lib/dialects/abstract/query-generator.js - About 1 day 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 exports has 245 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = BaseTypes => {
                      const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'https://www.sqlite.org/datatype3.html');
                    
                      /**
                       * Removes unsupported SQLite options, i.e., UNSIGNED and ZEROFILL, for the integer data types.
                    Severity: Major
                    Found in lib/dialects/sqlite/data-types.js - About 1 day to fix

                      File sequelize.js has 572 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      'use strict';
                      
                      const url = require('url');
                      const path = require('path');
                      const retry = require('retry-as-promised');
                      Severity: Major
                      Found in lib/sequelize.js - About 1 day to fix

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

                          selectQuery(tableName, options, model) {
                            options = options || {};
                            const limit = options.limit;
                            const mainQueryItems = [];
                            const subQueryItems = [];
                        Severity: Major
                        Found in lib/dialects/abstract/query-generator.js - About 1 day to fix

                          Function exports has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = BaseTypes => {
                            const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'https://msdn.microsoft.com/en-us/library/ms187752%28v=sql.110%29.aspx');
                          
                            /**
                             * Removes unsupported MSSQL options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
                          Severity: Minor
                          Found in lib/dialects/mssql/data-types.js - About 1 day 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 exports has 216 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = BaseTypes => {
                            const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'https://msdn.microsoft.com/en-us/library/ms187752%28v=sql.110%29.aspx');
                          
                            /**
                             * Removes unsupported MSSQL options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
                          Severity: Major
                          Found in lib/dialects/mssql/data-types.js - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language