sequelize/sequelize

View on GitHub
src/dialects/abstract/query-generator.js

Summary

Maintainability
F
1 mo
Test Coverage

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 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

    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 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

      QueryGenerator has 60 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class QueryGenerator {
        constructor(options) {
          if (!options.sequelize) throw new Error('QueryGenerator initialized without options.sequelize');
          if (!options._dialect) throw new Error('QueryGenerator initialized without options._dialect');
      
      
      Severity: Major
      Found in src/dialects/abstract/query-generator.js - About 1 day to fix

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

          insertQuery(table, valueHash, modelAttributes, options) {
            options = options || {};
            _.defaults(options, this.options);
        
            const modelAttributeMap = {};
        Severity: Minor
        Found in src/dialects/abstract/query-generator.js - About 7 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 whereItemQuery has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

          whereItemQuery(key, value, options = {}) {
            if (value === undefined) {
              throw new Error(`WHERE parameter "${key}" has invalid "undefined" value`);
            }
        
        
        Severity: Minor
        Found in src/dialects/abstract/query-generator.js - About 7 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 handleSequelizeMethod has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

          handleSequelizeMethod(smth, tableName, factory, options, prepend) {
            let result;
        
            if (Object.prototype.hasOwnProperty.call(this.OperatorMap, smth.comparator)) {
              smth.comparator = this.OperatorMap[smth.comparator];
        Severity: Minor
        Found in src/dialects/abstract/query-generator.js - About 7 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 addIndexQuery has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

          addIndexQuery(tableName, attributes, options, rawTablename) {
            options = options || {};
        
            if (!Array.isArray(attributes)) {
              options = attributes;
        Severity: Minor
        Found in src/dialects/abstract/query-generator.js - About 6 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 generateInclude has 141 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          generateInclude(include, parentTableName, topLevelInfo) {
            const joinQueries = {
              mainQuery: [],
              subQuery: []
            };
        Severity: Major
        Found in src/dialects/abstract/query-generator.js - About 5 hrs to fix

          Function generateJoin has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

            generateJoin(include, topLevelInfo) {
              const association = include.association;
              const parent = include.parent;
              const parentIsTop =
                !!parent && !include.parent.association && include.parent.model.name === topLevelInfo.options.model.name;
          Severity: Minor
          Found in src/dialects/abstract/query-generator.js - About 5 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 insertQuery has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            insertQuery(table, valueHash, modelAttributes, options) {
              options = options || {};
              _.defaults(options, this.options);
          
              const modelAttributeMap = {};
          Severity: Major
          Found in src/dialects/abstract/query-generator.js - About 5 hrs to fix

            Function _whereParseSingleValueObject has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

              _whereParseSingleValueObject(key, field, prop, value, options) {
                if (prop === Op.not) {
                  if (Array.isArray(value)) {
                    prop = Op.notIn;
                  } else if (value !== null && value !== true && value !== false) {
            Severity: Minor
            Found in src/dialects/abstract/query-generator.js - About 4 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 generateThroughJoin has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

              generateThroughJoin(include, includeAs, parentTableName, topLevelInfo) {
                const through = include.through;
                const throughTable = through.model.getTableName();
                const throughAs = `${includeAs.internalAs}->${through.as}`;
                const externalThroughAs = `${includeAs.externalAs}.${through.as}`;
            Severity: Minor
            Found in src/dialects/abstract/query-generator.js - About 4 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 quote has 117 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              quote(collection, parent, connector) {
                // init
                const validOrderOptions = [
                  'ASC',
                  'DESC',
            Severity: Major
            Found in src/dialects/abstract/query-generator.js - About 4 hrs to fix

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

                _whereParseSingleValueObject(key, field, prop, value, options) {
                  if (prop === Op.not) {
                    if (Array.isArray(value)) {
                      prop = Op.notIn;
                    } else if (value !== null && value !== true && value !== false) {
              Severity: Major
              Found in src/dialects/abstract/query-generator.js - About 4 hrs to fix

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

                  generateThroughJoin(include, includeAs, parentTableName, topLevelInfo) {
                    const through = include.through;
                    const throughTable = through.model.getTableName();
                    const throughAs = `${includeAs.internalAs}->${through.as}`;
                    const externalThroughAs = `${includeAs.externalAs}.${through.as}`;
                Severity: Major
                Found in src/dialects/abstract/query-generator.js - About 4 hrs to fix

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

                    whereItemQuery(key, value, options = {}) {
                      if (value === undefined) {
                        throw new Error(`WHERE parameter "${key}" has invalid "undefined" value`);
                      }
                  
                  
                  Severity: Major
                  Found in src/dialects/abstract/query-generator.js - About 3 hrs to fix

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

                      _generateSubQueryFilter(include, includeAs, topLevelInfo) {
                        if (!topLevelInfo.subQuery || !include.subQueryFilter) {
                          return;
                        }
                    
                    
                    Severity: Major
                    Found in src/dialects/abstract/query-generator.js - About 3 hrs to fix

                      Function getWhereConditions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getWhereConditions(smth, tableName, factory, options, prepend) {
                          const where = {};
                      
                          if (Array.isArray(tableName)) {
                            tableName = tableName[0];
                      Severity: Minor
                      Found in src/dialects/abstract/query-generator.js - About 3 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 generateJoin has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        generateJoin(include, topLevelInfo) {
                          const association = include.association;
                          const parent = include.parent;
                          const parentIsTop =
                            !!parent && !include.parent.association && include.parent.model.name === topLevelInfo.options.model.name;
                      Severity: Major
                      Found in src/dialects/abstract/query-generator.js - About 3 hrs to fix

                        Function updateQuery has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                          updateQuery(tableName, attrValueHash, where, options, attributes) {
                            options = options || {};
                            _.defaults(options, this.options);
                        
                            attrValueHash = Utils.removeNullValuesFromHash(attrValueHash, options.omitNull, options);
                        Severity: Minor
                        Found in src/dialects/abstract/query-generator.js - About 3 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 addIndexQuery has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          addIndexQuery(tableName, attributes, options, rawTablename) {
                            options = options || {};
                        
                            if (!Array.isArray(attributes)) {
                              options = attributes;
                        Severity: Major
                        Found in src/dialects/abstract/query-generator.js - About 3 hrs to fix

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

                            handleSequelizeMethod(smth, tableName, factory, options, prepend) {
                              let result;
                          
                              if (Object.prototype.hasOwnProperty.call(this.OperatorMap, smth.comparator)) {
                                smth.comparator = this.OperatorMap[smth.comparator];
                          Severity: Major
                          Found in src/dialects/abstract/query-generator.js - About 3 hrs to fix

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

                              updateQuery(tableName, attrValueHash, where, options, attributes) {
                                options = options || {};
                                _.defaults(options, this.options);
                            
                                attrValueHash = Utils.removeNullValuesFromHash(attrValueHash, options.omitNull, options);
                            Severity: Major
                            Found in src/dialects/abstract/query-generator.js - About 3 hrs to fix

                              Function getQueryOrders has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                getQueryOrders(options, model, subQuery) {
                                  const mainQueryOrder = [];
                                  const subQueryOrder = [];
                              
                                  if (Array.isArray(options.order)) {
                              Severity: Minor
                              Found in src/dialects/abstract/query-generator.js - 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 getConstraintSnippet has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                getConstraintSnippet(tableName, options) {
                                  let constraintSnippet, constraintName;
                              
                                  const fieldsSql = options.fields.map(field => {
                                    if (typeof field === 'string') {
                              Severity: Minor
                              Found in src/dialects/abstract/query-generator.js - 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 getConstraintSnippet has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                getConstraintSnippet(tableName, options) {
                                  let constraintSnippet, constraintName;
                              
                                  const fieldsSql = options.fields.map(field => {
                                    if (typeof field === 'string') {
                              Severity: Major
                              Found in src/dialects/abstract/query-generator.js - About 2 hrs to fix

                                Consider simplifying this complex logical expression.
                                Open

                                        if (
                                          subQuery &&
                                          Array.isArray(order) &&
                                          order[0] &&
                                          !(order[0] instanceof Association) &&
                                Severity: Critical
                                Found in src/dialects/abstract/query-generator.js - About 2 hrs to fix

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

                                    bulkInsertQuery(tableName, fieldValueHashes, options, fieldMappedAttributes) {
                                      options = options || {};
                                      fieldMappedAttributes = fieldMappedAttributes || {};
                                  
                                      const tuples = [];
                                  Severity: Major
                                  Found in src/dialects/abstract/query-generator.js - About 2 hrs to fix

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

                                      getWhereConditions(smth, tableName, factory, options, prepend) {
                                        const where = {};
                                    
                                        if (Array.isArray(tableName)) {
                                          tableName = tableName[0];
                                    Severity: Major
                                    Found in src/dialects/abstract/query-generator.js - About 2 hrs to fix

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

                                        _generateSubQueryFilter(include, includeAs, topLevelInfo) {
                                          if (!topLevelInfo.subQuery || !include.subQueryFilter) {
                                            return;
                                          }
                                      
                                      
                                      Severity: Minor
                                      Found in src/dialects/abstract/query-generator.js - 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 bulkInsertQuery has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        bulkInsertQuery(tableName, fieldValueHashes, options, fieldMappedAttributes) {
                                          options = options || {};
                                          fieldMappedAttributes = fieldMappedAttributes || {};
                                      
                                          const tuples = [];
                                      Severity: Minor
                                      Found in src/dialects/abstract/query-generator.js - 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 quote has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        quote(collection, parent, connector) {
                                          // init
                                          const validOrderOptions = [
                                            'ASC',
                                            'DESC',
                                      Severity: Minor
                                      Found in src/dialects/abstract/query-generator.js - About 1 hr 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 quoteTable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        quoteTable(param, alias) {
                                          let table = '';
                                      
                                          if (alias === true) {
                                            alias = param.as || param.name || param;
                                      Severity: Minor
                                      Found in src/dialects/abstract/query-generator.js - About 1 hr 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 escapeAttributes has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        escapeAttributes(attributes, options, mainTableAs) {
                                          return (
                                            attributes &&
                                            attributes.map(attr => {
                                              let addTable = true;
                                      Severity: Minor
                                      Found in src/dialects/abstract/query-generator.js - About 1 hr to fix

                                        Function escape has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          escape(value, field, options) {
                                            options = options || {};
                                        
                                            if (value !== null && value !== undefined) {
                                              if (value instanceof Utils.SequelizeMethod) {
                                        Severity: Minor
                                        Found in src/dialects/abstract/query-generator.js - About 1 hr 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 getQueryOrders has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          getQueryOrders(options, model, subQuery) {
                                            const mainQueryOrder = [];
                                            const subQueryOrder = [];
                                        
                                            if (Array.isArray(options.order)) {
                                        Severity: Minor
                                        Found in src/dialects/abstract/query-generator.js - About 1 hr to fix

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

                                                const includeAttributes = include.attributes.map(attr => {
                                                  let attrAs = attr;
                                                  let verbatim = false;
                                          
                                                  if (Array.isArray(attr) && attr.length === 2) {
                                          Severity: Minor
                                          Found in src/dialects/abstract/query-generator.js - About 1 hr to fix

                                            Function validate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                              validate(value, field, options) {
                                                if (this.typeValidation && field.type.validate && value) {
                                                  try {
                                                    if (options.isList && Array.isArray(value)) {
                                                      for (const item of value) {
                                            Severity: Minor
                                            Found in src/dialects/abstract/query-generator.js - About 1 hr 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 arithmeticQuery has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                              arithmeticQuery(operator, tableName, where, incrementAmountsByField, extraAttributesToBeUpdated, options) {
                                                options = options || {};
                                                _.defaults(options, { returning: true });
                                            
                                                extraAttributesToBeUpdated = Utils.removeNullValuesFromHash(extraAttributesToBeUpdated, this.options.omitNull);
                                            Severity: Minor
                                            Found in src/dialects/abstract/query-generator.js - About 1 hr to fix

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

                                                  const fieldsSql = options.fields.map(field => {
                                                    if (field instanceof Utils.SequelizeMethod) {
                                                      return this.handleSequelizeMethod(field);
                                                    }
                                                    if (typeof field === 'string') {
                                              Severity: Minor
                                              Found in src/dialects/abstract/query-generator.js - About 1 hr to fix

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

                                                  generateReturnValues(modelAttributes, options) {
                                                    const returnFields = [];
                                                    const returnTypes = [];
                                                    let outputFragment = '';
                                                    let returningFragment = '';
                                                Severity: Minor
                                                Found in src/dialects/abstract/query-generator.js - About 1 hr to fix

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

                                                    jsonPathExtractionQuery(column, path) {
                                                      let paths = _.toPath(path);
                                                      let pathStr;
                                                      const quotedColumn = this.isIdentifierQuoted(column) ? column : this.quoteIdentifier(column);
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in src/dialects/abstract/query-generator.js - About 1 hr to fix

                                                    Function format has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                      format(value, field, options, bindParam) {
                                                        options = options || {};
                                                    
                                                        if (value !== null && value !== undefined) {
                                                          if (value instanceof Utils.SequelizeMethod) {
                                                    Severity: Minor
                                                    Found in src/dialects/abstract/query-generator.js - About 1 hr 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 (Array.isArray(order)) {
                                                                    order = order[0];
                                                                  }
                                                    Severity: Major
                                                    Found in src/dialects/abstract/query-generator.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 (previousModel.rawAttributes[itemSplit[0]].type instanceof DataTypes.JSON) {
                                                                      // just quote identifiers for now
                                                                      const identifier = this.quoteIdentifiers(
                                                                        `${previousModel.name}.${previousModel.rawAttributes[itemSplit[0]].field}`
                                                                      );
                                                      Severity: Major
                                                      Found in src/dialects/abstract/query-generator.js - About 45 mins to fix

                                                        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

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

                                                            selectFromTableFragment(options, model, attributes, tables, mainTableAs) {
                                                              this._throwOnEmptyAttributes(attributes, {
                                                                modelName: model && model.name,
                                                                as: mainTableAs
                                                              });
                                                          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 (Array.isArray(options.order[i])) {
                                                                          options.order[i][0] = alias;
                                                                        } else {
                                                                          options.order[i] = alias;
                                                                        }
                                                          Severity: Major
                                                          Found in src/dialects/abstract/query-generator.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

                                                            Consider simplifying this complex logical expression.
                                                            Open

                                                                  if (value instanceof Utils.SequelizeMethod || options.bindParam === false) {
                                                                    values.push(
                                                                      `${this.quoteIdentifier(key)}=${this.escape(
                                                                        value,
                                                                        (modelAttributeMap && modelAttributeMap[key]) || undefined,
                                                            Severity: Major
                                                            Found in src/dialects/abstract/query-generator.js - About 40 mins to fix

                                                              Consider simplifying this complex logical expression.
                                                              Open

                                                                  if (topLevelInfo.subQuery && !include.subQuery && include.parent.subQuery && !parentIsTop) {
                                                                    // If we are minifying aliases and our JOIN target has been minified, we need to use the alias instead of the original column name
                                                                    const joinSource =
                                                                      this._getAliasForField(tableSource, `${tableSource}.${attrSource}`, topLevelInfo.options) ||
                                                                      `${tableSource}.${attrSource}`;
                                                              Severity: Major
                                                              Found in src/dialects/abstract/query-generator.js - About 40 mins to fix

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                          if (value instanceof Utils.SequelizeMethod || options.bindParam === false) {
                                                                            values.push(
                                                                              this.escape(value, (modelAttributeMap && modelAttributeMap[key]) || undefined, { context: 'INSERT' })
                                                                            );
                                                                          } else {
                                                                Severity: Major
                                                                Found in src/dialects/abstract/query-generator.js - About 40 mins to fix

                                                                  Function generateReturnValues has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                    generateReturnValues(modelAttributes, options) {
                                                                      const returnFields = [];
                                                                      const returnTypes = [];
                                                                      let outputFragment = '';
                                                                      let returningFragment = '';
                                                                  Severity: Minor
                                                                  Found in src/dialects/abstract/query-generator.js - About 35 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 too many return statements within this function.
                                                                  Open

                                                                      return smth.toString(this, factory);
                                                                  Severity: Major
                                                                  Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                        return this._joinKeyValue(key, opValue, this.OperatorMap[Op.eq], options.prefix);
                                                                    Severity: Major
                                                                    Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return this._joinKeyValue(
                                                                                key,
                                                                                value.map(identifier => this.quoteIdentifier(identifier)).join('.'),
                                                                                comparator,
                                                                                options.prefix
                                                                      Severity: Major
                                                                      Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                            return '1=1';
                                                                        Severity: Major
                                                                        Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                return this._joinKeyValue(key, opValue, this.OperatorMap[Op.eq], options.prefix);
                                                                          Severity: Major
                                                                          Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                  return this._joinKeyValue(this.OperatorMap[key], opValue, this.OperatorMap[Op.eq], options.prefix);
                                                                            Severity: Major
                                                                            Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                    return `${smth.fn}(${smth.args
                                                                                      .map(arg => {
                                                                                        if (arg instanceof Utils.SequelizeMethod) {
                                                                                          return this.handleSequelizeMethod(arg, tableName, factory, options, prepend);
                                                                                        }
                                                                              Severity: Major
                                                                              Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                      return this._whereBind(this.OperatorMap[Op.or], key, value[Op.or], options);
                                                                                Severity: Major
                                                                                Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                        if (smth.length === 0 || (smth.length > 0 && smth[0].length === 0)) return '1=1';
                                                                                  Severity: Major
                                                                                  Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                            return this.getWhereConditions(_smth, tableName, factory, options, prepend);
                                                                                    Severity: Major
                                                                                    Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                            return this._joinKeyValue(key, opValue, this.OperatorMap[Op.eq], options.prefix);
                                                                                      Severity: Major
                                                                                      Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                return this._joinKeyValue(key, `(${this.escape(value, field)})`, comparator, options.prefix);
                                                                                        Severity: Major
                                                                                        Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                  return this._joinKeyValue(key, this.whereItemQuery(null, value), comparator, options.prefix);
                                                                                          Severity: Major
                                                                                          Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                return this._joinKeyValue(key, this.escape(value, field, escapeOptions), comparator, options.prefix);
                                                                                            Severity: Major
                                                                                            Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                    return this._whereJSON(key, value, options);
                                                                                              Severity: Major
                                                                                              Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                      return this._whereBind(this.OperatorMap[Op.and], key, value, options);
                                                                                                Severity: Major
                                                                                                Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                          return '*';
                                                                                                  Severity: Major
                                                                                                  Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                              return this._joinKeyValue(
                                                                                                                key,
                                                                                                                `(VALUES ${value[Op.values].map(item => `(${this.escape(item)})`).join(', ')})`,
                                                                                                                comparator,
                                                                                                                options.prefix
                                                                                                    Severity: Major
                                                                                                    Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                              return this._joinKeyValue(key, this.escape(pattern), comparator, options.prefix);
                                                                                                      Severity: Major
                                                                                                      Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                return this._joinKeyValue(
                                                                                                                  key,
                                                                                                                  `(${this.escape(value[Op.all], field, escapeOptions)})`,
                                                                                                                  `${comparator} ${this.OperatorMap[Op.all]}`,
                                                                                                                  options.prefix
                                                                                                        Severity: Major
                                                                                                        Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                return this._whereGroupBind(key, value, options);
                                                                                                          Severity: Major
                                                                                                          Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

                                                                                                                  return this.escape(smth);
                                                                                                            Severity: Major
                                                                                                            Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

                                                                                                                    return this.quote(smth.col, factory);
                                                                                                              Severity: Major
                                                                                                              Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

                                                                                                                      return this.handleSequelizeMethod(value);
                                                                                                                Severity: Major
                                                                                                                Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

                                                                                                                        return this._joinKeyValue(key, this.escape(value, field, escapeOptions), this.OperatorMap[Op.is], options.prefix);
                                                                                                                  Severity: Major
                                                                                                                  Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

                                                                                                                          return this.whereItemsQuery(smth, {
                                                                                                                            model: factory,
                                                                                                                            prefix: prepend && tableName
                                                                                                                          });
                                                                                                                    Severity: Major
                                                                                                                    Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

                                                                                                                            return `CAST(${result} AS ${smth.type.toUpperCase()})`;
                                                                                                                      Severity: Major
                                                                                                                      Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

                                                                                                                              return this._whereBind(this.OperatorMap[Op.and], key, value[Op.and], options);
                                                                                                                        Severity: Major
                                                                                                                        Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

                                                                                                                                return this._whereParseSingleValueObject(key, field, Op.in, value, options);
                                                                                                                          Severity: Major
                                                                                                                          Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

                                                                                                                                    return this._joinKeyValue(
                                                                                                                                      key,
                                                                                                                                      `(${this.escape(value[Op.any], field, escapeOptions)})`,
                                                                                                                                      `${comparator} ${this.OperatorMap[Op.any]}`,
                                                                                                                                      options.prefix
                                                                                                                            Severity: Major
                                                                                                                            Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

                                                                                                                                    return this._joinKeyValue(
                                                                                                                                      key,
                                                                                                                                      this.escape(value, field, escapeOptions),
                                                                                                                                      this.OperatorMap[Op.not],
                                                                                                                                      options.prefix
                                                                                                                              Severity: Major
                                                                                                                              Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

                                                                                                                                        return this._whereParseSingleValueObject(key, field, valueKeys[0], value[valueKeys[0]], options);
                                                                                                                                Severity: Major
                                                                                                                                Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

                                                                                                                                        return this._whereParseSingleValueObject(key, field, this.OperatorMap[Op.eq], value, options);
                                                                                                                                  Severity: Major
                                                                                                                                  Found in src/dialects/abstract/query-generator.js - About 30 mins to fix

                                                                                                                                    Function jsonPathExtractionQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                    Open

                                                                                                                                      jsonPathExtractionQuery(column, path) {
                                                                                                                                        let paths = _.toPath(path);
                                                                                                                                        let pathStr;
                                                                                                                                        const quotedColumn = this.isIdentifierQuoted(column) ? column : this.quoteIdentifier(column);
                                                                                                                                    
                                                                                                                                    
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js - About 25 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

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (include.subQuery && topLevelInfo.subQuery) {
                                                                                                                                          if (requiredMismatch && subChildIncludes.length > 0) {
                                                                                                                                            joinQueries.subQuery.push(
                                                                                                                                              ` ${joinQuery.join} ( ${joinQuery.body}${subChildIncludes.join('')} ) ON ${joinQuery.condition}`
                                                                                                                                            );
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 7 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1702..1714

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 187.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        } else {
                                                                                                                                          if (requiredMismatch && mainChildIncludes.length > 0) {
                                                                                                                                            joinQueries.mainQuery.push(
                                                                                                                                              ` ${joinQuery.join} ( ${joinQuery.body}${mainChildIncludes.join('')} ) ON ${joinQuery.condition}`
                                                                                                                                            );
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 7 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1690..1702

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 187.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (value instanceof Utils.SequelizeMethod || options.bindParam === false) {
                                                                                                                                            values.push(
                                                                                                                                              `${this.quoteIdentifier(key)}=${this.escape(
                                                                                                                                                value,
                                                                                                                                                (modelAttributeMap && modelAttributeMap[key]) || undefined,
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 5 hrs to fix
                                                                                                                                    src/dialects/sqlite/query-generator.js on lines 210..227

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 152.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (this._dialect.supports.inserts.updateOnDuplicate == ' ON CONFLICT DO UPDATE SET') {
                                                                                                                                            // postgres / sqlite
                                                                                                                                            // If no conflict target columns were specified, use the primary key names from options.upsertKeys
                                                                                                                                            const conflictKeys = options.upsertKeys.map(attr => this.quoteIdentifier(attr));
                                                                                                                                            const updateKeys = options.updateOnDuplicate.map(
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 4 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 300..314

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 126.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (this._dialect.supports.inserts.updateOnDuplicate == ' ON CONFLICT DO UPDATE SET') {
                                                                                                                                            // postgres / sqlite
                                                                                                                                            // If no conflict target columns were specified, use the primary key names from options.upsertKeys
                                                                                                                                            const conflictKeys = options.upsertKeys.map(attr => this.quoteIdentifier(attr));
                                                                                                                                            const updateKeys = options.updateOnDuplicate.map(
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 4 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 191..204

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 126.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (value[Op.any]) {
                                                                                                                                            escapeOptions.isList = true;
                                                                                                                                            return this._joinKeyValue(
                                                                                                                                              key,
                                                                                                                                              `(${this.escape(value[Op.any], field, escapeOptions)})`,
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 3 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2832..2840

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 96.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (value[Op.all]) {
                                                                                                                                            escapeOptions.isList = true;
                                                                                                                                            return this._joinKeyValue(
                                                                                                                                              key,
                                                                                                                                              `(${this.escape(value[Op.all], field, escapeOptions)})`,
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 3 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2823..2831

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 96.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (!value) {
                                                                                                                                          const opValue = options.bindParam
                                                                                                                                            ? this.format(value, field, options, options.bindParam)
                                                                                                                                            : this.escape(value, field);
                                                                                                                                          return this._joinKeyValue(key, opValue, this.OperatorMap[Op.eq], options.prefix);
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 2 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2495..2500

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 75.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (isArray && fieldType instanceof DataTypes.ARRAY) {
                                                                                                                                          const opValue = options.bindParam
                                                                                                                                            ? this.format(value, field, options, options.bindParam)
                                                                                                                                            : this.escape(value, field);
                                                                                                                                          return this._joinKeyValue(key, opValue, this.OperatorMap[Op.eq], options.prefix);
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 2 hrs to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2463..2468

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 75.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (value === null && comparator === this.OperatorMap[Op.eq]) {
                                                                                                                                          return this._joinKeyValue(key, this.escape(value, field, escapeOptions), this.OperatorMap[Op.is], options.prefix);
                                                                                                                                        }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2846..2853

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 71.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (value === null && comparator === this.OperatorMap[Op.ne]) {
                                                                                                                                          return this._joinKeyValue(
                                                                                                                                            key,
                                                                                                                                            this.escape(value, field, escapeOptions),
                                                                                                                                            this.OperatorMap[Op.not],
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2843..2845

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 71.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (attributes) {
                                                                                                                                          _.each(attributes, (attribute, key) => {
                                                                                                                                            modelAttributeMap[key] = attribute;
                                                                                                                                            if (attribute.field) {
                                                                                                                                              modelAttributeMap[attribute.field] = attribute;
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/sqlite/query-generator.js on lines 198..205

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 63.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (value === 'NULL') {
                                                                                                                                            if (smth.comparator === '=') {
                                                                                                                                              smth.comparator = 'IS';
                                                                                                                                            }
                                                                                                                                            if (smth.comparator === '!=') {
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2309..2316

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 63.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                            if (value === 'NULL') {
                                                                                                                                              if (smth.comparator === '=') {
                                                                                                                                                smth.comparator = 'IS';
                                                                                                                                              }
                                                                                                                                              if (smth.comparator === '!=') {
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2331..2338

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 63.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                            if (joinQueries.attributes.main.length > 0) {
                                                                                                                                              attributes.main = _.uniq(attributes.main.concat(joinQueries.attributes.main));
                                                                                                                                            }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1254..1256

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 62.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                            if (joinQueries.attributes.subQuery.length > 0) {
                                                                                                                                              attributes.subQuery = _.uniq(attributes.subQuery.concat(joinQueries.attributes.subQuery));
                                                                                                                                            }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1251..1253

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 62.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                      describeTableQuery(tableName, schema, schemaDelimiter) {
                                                                                                                                        const table = this.quoteTable(
                                                                                                                                          this.addSchema({
                                                                                                                                            tableName,
                                                                                                                                            _schema: schema,
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/mysql/query-generator.js on lines 149..159

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 62.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          case 'PRIMARY KEY':
                                                                                                                                            constraintName = this.quoteIdentifier(options.name || `${tableName}_${fieldsSqlString}_pk`);
                                                                                                                                            constraintSnippet = `CONSTRAINT ${constraintName} PRIMARY KEY (${fieldsSqlQuotedString})`;
                                                                                                                                            break;
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 671..674

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 61.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          case 'UNIQUE':
                                                                                                                                            constraintName = this.quoteIdentifier(options.name || `${tableName}_${fieldsSqlString}_uk`);
                                                                                                                                            constraintSnippet = `CONSTRAINT ${constraintName} UNIQUE (${fieldsSqlQuotedString})`;
                                                                                                                                            break;
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 694..697

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 61.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                            if (value.length > 2) {
                                                                                                                                              value = [
                                                                                                                                                // join the tables by -> to match out internal namings
                                                                                                                                                value.slice(0, -1).join('->'),
                                                                                                                                                value[value.length - 1]
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2699..2705

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 58.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (key.length > 2) {
                                                                                                                                            key = [
                                                                                                                                              // join the tables by -> to match out internal namings
                                                                                                                                              key.slice(0, -1).join('->'),
                                                                                                                                              key[key.length - 1]
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2784..2790

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 58.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          joinOn = this.whereItemsQuery(include.on, {
                                                                                                                                            prefix: this.sequelize.literal(this.quoteIdentifier(asRight)),
                                                                                                                                            model: include.model
                                                                                                                                          });
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1826..1829

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 55.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          joinWhere = this.whereItemsQuery(include.where, {
                                                                                                                                            prefix: this.sequelize.literal(this.quoteIdentifier(asRight)),
                                                                                                                                            model: include.model
                                                                                                                                          });
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 1 hr to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1819..1822

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 55.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                            if (childJoinQueries.attributes.main.length > 0) {
                                                                                                                                              attributes.main = attributes.main.concat(childJoinQueries.attributes.main);
                                                                                                                                            }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 2 other locations - About 55 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1659..1661
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1684..1686

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 54.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                            if (childJoinQueries.attributes.subQuery.length > 0) {
                                                                                                                                              attributes.subQuery = attributes.subQuery.concat(childJoinQueries.attributes.subQuery);
                                                                                                                                            }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 2 other locations - About 55 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1659..1661
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1681..1683

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 54.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (options.model && options.model.fieldRawAttributesMap && options.model.fieldRawAttributesMap[key]) {
                                                                                                                                          return options.model.fieldRawAttributesMap[key];
                                                                                                                                        }
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 55 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2538..2540

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 54.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (joinQuery.attributes.subQuery.length > 0) {
                                                                                                                                          attributes.subQuery = attributes.subQuery.concat(joinQuery.attributes.subQuery);
                                                                                                                                        }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 2 other locations - About 55 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1681..1683
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1684..1686

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 54.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (options.model && options.model.rawAttributes && options.model.rawAttributes[key]) {
                                                                                                                                          return options.model.rawAttributes[key];
                                                                                                                                        }
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 55 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2542..2544

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 54.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (value[Op.and]) {
                                                                                                                                          return this._whereBind(this.OperatorMap[Op.and], key, value[Op.and], options);
                                                                                                                                        }
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 40 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2487..2489

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 49.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (value[Op.or]) {
                                                                                                                                          return this._whereBind(this.OperatorMap[Op.or], key, value[Op.or], options);
                                                                                                                                        }
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 40 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2491..2493

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 49.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          this._dialect.supports.index.using === 1 && options.using ? `USING ${options.using}` : '',
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 40 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 621..621

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 48.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          this._dialect.supports.index.using === 2 && options.using ? `USING ${options.using}` : '',
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 40 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 619..619

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 48.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (typeof value === 'boolean') {
                                                                                                                                            value = this.booleanValue(value);
                                                                                                                                          } else {
                                                                                                                                            value = this.escape(value);
                                                                                                                                          }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 3 other locations - About 35 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 599..603
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 631..635
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 725..729

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 47.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (typeof tableName === 'string') {
                                                                                                                                          tableName = this.quoteIdentifiers(tableName);
                                                                                                                                        } else {
                                                                                                                                          tableName = this.quoteTable(tableName);
                                                                                                                                        }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 3 other locations - About 35 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 599..603
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 725..729
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2325..2329

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 47.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (typeof tableName === 'string') {
                                                                                                                                          tableName = this.quoteIdentifiers(tableName);
                                                                                                                                        } else {
                                                                                                                                          tableName = this.quoteTable(tableName);
                                                                                                                                        }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 3 other locations - About 35 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 599..603
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 631..635
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2325..2329

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 47.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        if (typeof tableName === 'string') {
                                                                                                                                          tableName = this.quoteIdentifiers(tableName);
                                                                                                                                        } else {
                                                                                                                                          tableName = this.quoteTable(tableName);
                                                                                                                                        }
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 3 other locations - About 35 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 631..635
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 725..729
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 2325..2329

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 47.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (orders.mainQueryOrder.length) {
                                                                                                                                            mainQueryItems.push(` ORDER BY ${orders.mainQueryOrder.join(', ')}`);
                                                                                                                                          }
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 35 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1452..1454

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 47.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                    Open

                                                                                                                                          if (orders.subQueryOrder.length) {
                                                                                                                                            subQueryItems.push(` ORDER BY ${orders.subQueryOrder.join(', ')}`);
                                                                                                                                          }
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in src/dialects/abstract/query-generator.js and 1 other location - About 35 mins to fix
                                                                                                                                    src/dialects/abstract/query-generator.js on lines 1449..1451

                                                                                                                                    Duplicated Code

                                                                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                    Tuning

                                                                                                                                    This issue has a mass of 47.

                                                                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                    Refactorings

                                                                                                                                    Further Reading

                                                                                                                                    There are no issues that match your filters.

                                                                                                                                    Category
                                                                                                                                    Status