sequelize/sequelize

View on GitHub

Showing 503 of 787 total issues

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

const assert = require('assert');
const _ = require('lodash');
const Dottie = require('dottie');

const Utils = require('./utils');
Severity: Major
Found in src/model.js - About 1 wk to fix

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

    const util = require('util');
    const _ = require('lodash');
    const uuidv4 = require('uuid').v4;
    
    const Utils = require('../../utils');
    Severity: Major
    Found in src/dialects/abstract/query-generator.js - About 6 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
           * All fields for a level is grouped in the same set (i.e. Panel.id, Task.id, Panel.title is not possible)
      Severity: Minor
      Found in src/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 144 (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 src/dialects/postgres/data-types.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

      Function run has a Cognitive Complexity of 120 (exceeds 5 allowed). Consider refactoring.
      Open

        async run(sql, parameters) {
          const { connection } = this;
      
          if (!_.isEmpty(this.options.searchPath)) {
            sql = this.sequelize.getQueryInterface().queryGenerator.setSearchPath(this.options.searchPath) + sql;
      Severity: Minor
      Found in src/dialects/postgres/query.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

      Function exports has 441 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 src/dialects/postgres/data-types.js - About 2 days to fix

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

          selectQuery(tableName, options, model) {
            options = options || {};
            const limit = options.limit;
            const mainQueryItems = [];
            const subQueryItems = [];
        Severity: Minor
        Found in src/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

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

        const _ = require('lodash');
        const Utils = require('../../utils');
        const DataTypes = require('../../data-types');
        const TableHints = require('../../table-hints');
        const AbstractQueryGenerator = require('../abstract/query-generator');
        Severity: Major
        Found in src/dialects/mssql/query-generator.js - About 1 day to fix

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

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

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

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

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

                set(key, value, options) {
                  let values;
                  let originalValue;
              
                  if (typeof key === 'object' && key !== null) {
              Severity: Minor
              Found in src/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

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

                generateInclude(include, parentTableName, topLevelInfo) {
                  const joinQueries = {
                    mainQuery: [],
                    subQuery: []
                  };
              Severity: Minor
              Found in src/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 bulkCreate has 305 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static async bulkCreate(records, options = {}) {
                  if (!records.length) {
                    return [];
                  }
              
              
              Severity: Major
              Found in src/model.js - About 1 day to fix

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

                    const recursiveBulkCreate = async (instances, options) => {
                      options = {
                        validate: false,
                        hooks: true,
                        individualHooks: false,
                Severity: Major
                Found in src/model.js - About 1 day to fix

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

                  const util = require('util');
                  const _ = require('lodash');
                  const wkx = require('wkx');
                  const sequelizeErrors = require('./errors');
                  const Validator = require('./utils/validator-extras').validator;
                  Severity: Major
                  Found in src/data-types.js - About 1 day to fix

                    Function selectQuery has 282 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 src/dialects/abstract/query-generator.js - About 1 day to fix

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

                      const _ = require('lodash');
                      
                      const Utils = require('../../utils');
                      const DataTypes = require('../../data-types');
                      const Transaction = require('../../transaction');
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js - About 1 day to fix

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

                          static _groupJoinData(rows, includeOptions, options) {
                            /*
                             * Assumptions
                             * ID is not necessarily the first field
                             * All fields for a level is grouped in the same set (i.e. Panel.id, Task.id, Panel.title is not possible)
                        Severity: Major
                        Found in src/dialects/abstract/query.js - About 1 day to fix

                          File belongs-to-many.js has 594 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          const Utils = require('./../utils');
                          const Helpers = require('./helpers');
                          const _ = require('lodash');
                          const Association = require('./base');
                          const BelongsTo = require('./belongs-to');
                          Severity: Major
                          Found in src/associations/belongs-to-many.js - About 1 day to fix

                            Function save has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async save(options) {
                                if (arguments.length > 1) {
                                  throw new Error('The second argument was removed in favor of the options object.');
                                }
                            
                            
                            Severity: Minor
                            Found in src/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

                            Severity
                            Category
                            Status
                            Source
                            Language