lebretr/sequelize-oracle

View on GitHub
lib/dialects/postgres/query-generator.js

Summary

Maintainability
F
2 wks
Test Coverage

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

module.exports = (function() {
  var QueryGenerator = {
    options: {},
    dialect: 'postgres',

Severity: Minor
Found in lib/dialects/postgres/query-generator.js - About 5 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

module.exports = (function() {
  var QueryGenerator = {
    options: {},
    dialect: 'postgres',

Severity: Major
Found in lib/dialects/postgres/query-generator.js - About 3 days to fix

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

    var Utils       = require("../../utils")
      , util        = require("util")
      , DataTypes   = require("../../data-types")
      , SqlString   = require("../../sql-string")
      , tables      = {}
    Severity: Major
    Found in lib/dialects/postgres/query-generator.js - About 1 day to fix

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

          attributesToSQL: function(attributes) {
            var result = {}
      
            for (var name in attributes) {
              var dataType = attributes[name]
      Severity: Major
      Found in lib/dialects/postgres/query-generator.js - About 2 hrs to fix

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

            changeColumnQuery: function(tableName, attributes) {
              var query = "ALTER TABLE <%= tableName %> ALTER COLUMN <%= query %>;"
                , sql   = []
        
              for (var attributeName in attributes) {
        Severity: Minor
        Found in lib/dialects/postgres/query-generator.js - About 1 hr to fix

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

              createTableQuery: function(tableName, attributes, options) {
                var self = this
          
                options = Utils._.extend({
                }, options || {})
          Severity: Minor
          Found in lib/dialects/postgres/query-generator.js - About 1 hr to fix

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

                bulkInsertQuery: function(tableName, attrValueHashes, options) {
                  var query        = "INSERT INTO <%= table %> (<%= attributes %>) VALUES <%= tuples %> RETURNING *;"
                    , tuples       = []
                    , serials      = []
                    , allAttributes = []
            Severity: Minor
            Found in lib/dialects/postgres/query-generator.js - About 1 hr to fix

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

                  addIndexQuery: function(tableName, attributes, options) {
                    var transformedAttributes = attributes.map(function(attribute) {
                      if (typeof attribute === 'string') {
                        return this.quoteIdentifier(attribute)
                      } else {
              Severity: Minor
              Found in lib/dialects/postgres/query-generator.js - About 1 hr to fix

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

                    pgDataTypeMapping: function (tableName, attr, dataType) {
                      if (Utils._.includes(dataType, 'PRIMARY KEY')) {
                        primaryKeys[tableName].push(attr)
                        dataType = dataType.replace(/PRIMARY KEY/, '')
                      }
                Severity: Minor
                Found in lib/dialects/postgres/query-generator.js - About 1 hr to fix

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

                      deleteQuery: function(tableName, where, options, factory) {
                        options = options || {}
                  
                        if (options.truncate === true) {
                          return "TRUNCATE " + QueryGenerator.quoteIdentifier(tableName)
                  Severity: Minor
                  Found in lib/dialects/postgres/query-generator.js - About 1 hr to fix

                    Function createTrigger has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        createTrigger: function(tableName, triggerName, eventType, fireOnSpec, functionName, functionParams, optionsArray) {
                    Severity: Major
                    Found in lib/dialects/postgres/query-generator.js - About 50 mins to fix

                      Function createFunction has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          createFunction: function(functionName, params, returnType, language, body, options) {
                      Severity: Minor
                      Found in lib/dialects/postgres/query-generator.js - About 45 mins to fix

                        Function arrayValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            arrayValue: function(value, key, _key, factory, logicResult){
                        Severity: Minor
                        Found in lib/dialects/postgres/query-generator.js - About 35 mins to fix

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

                                    if(dataType.references) {
                                      template += " REFERENCES <%= referencesTable %> (<%= referencesKey %>)"
                                      replacements.referencesTable = this.quoteIdentifiers(dataType.references)
                          
                                      if(dataType.referencesKey) {
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 7 hrs to fix
                          lib/dialects/sqlite/query-generator.js on lines 280..300

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

                          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

                                var transformedAttributes = attributes.map(function(attribute) {
                                  if (typeof attribute === 'string') {
                                    return this.quoteIdentifier(attribute)
                                  } else {
                                    var result = ""
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 6 hrs to fix
                          lib/dialects/mysql/query-generator.js on lines 247..269

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

                          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(!force && this.options && this.options.quoteIdentifiers === false) { // default is `true`
                                  // In Postgres, if tables or attributes are created double-quoted,
                                  // they are also case sensitive. If they contain any uppercase
                                  // characters, they must always be double-quoted. This makes it
                                  // impossible to write queries in portable SQL if tables are created in
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 1 hr to fix
                          lib/dialects/oracle/query-generator.js on lines 367..376

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

                          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

                              quoteIdentifiers: function(identifiers, force) {
                                return identifiers.split('.').map(function(t) { return this.quoteIdentifier(t, force) }.bind(this)).join('.')
                              },
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 3 other locations - About 1 hr to fix
                          lib/dialects/mysql/query-generator.js on lines 417..419
                          lib/dialects/oracle/query-generator.js on lines 379..381
                          lib/dialects/sqlite/query-generator.js on lines 427..429

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

                          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

                              removeColumnQuery: function(tableName, attributeName) {
                                var query = "ALTER TABLE <%= tableName %> DROP COLUMN <%= attributeName %>;"
                                return Utils._.template(query)({
                                  tableName:     this.quoteIdentifiers(tableName),
                                  attributeName: this.quoteIdentifier(attributeName)
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 1 hr to fix
                          lib/dialects/abstract/query-generator.js on lines 39..45

                          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

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

                                        replacements.type = "ENUM(" + Utils._.map(dataType.values, function(value) {
                                          return this.escape(value)
                                        }.bind(this)).join(", ") + ")"
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 1 hr to fix
                          lib/dialects/mysql/query-generator.js on lines 319..321

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

                          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 (definition.indexOf('NOT NULL') > 0) {
                                    attrSql += Utils._.template(query)({
                                      tableName: this.quoteIdentifiers(tableName),
                                      query:     this.quoteIdentifier(attributeName) + ' SET NOT NULL'
                                    })
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 1 hr to fix
                          lib/dialects/postgres/query-generator.js on lines 214..226

                          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 (definition.indexOf('DEFAULT') > 0) {
                                    attrSql += Utils._.template(query)({
                                      tableName: this.quoteIdentifiers(tableName),
                                      query:     this.quoteIdentifier(attributeName) + ' SET DEFAULT ' + definition.match(/DEFAULT ([^;]+)/)[1]
                                    })
                          Severity: Major
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 1 hr to fix
                          lib/dialects/postgres/query-generator.js on lines 200..212

                          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

                                for (var name in factory.attributes) {
                                  var definition = factory.attributes[name]
                          
                                  if (definition && (definition.indexOf('SERIAL') > -1)) {
                                    fields.push(name)
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 55 mins to fix
                          lib/dialects/mysql/query-generator.js on lines 386..392

                          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

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

                                    if (Utils.defaultValueSchemable(dataType.defaultValue)) {
                                      // TODO thoroughly check that DataTypes.NOW will properly
                                      // get populated on all databases as DEFAULT value
                                      // i.e. mysql requires: DEFAULT CURRENT_TIMESTAMP
                                      template += " DEFAULT <%= defaultValue %>"
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 55 mins to fix
                          lib/dialects/sqlite/query-generator.js on lines 260..266

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

                          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

                              dropTrigger: function(tableName, triggerName) {
                                var sql = 'DROP TRIGGER <%= triggerName %> ON <%= tableName %> RESTRICT;'
                                return Utils._.template(sql)({
                                  triggerName: triggerName,
                                  tableName: tableName
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 40 mins to fix
                          lib/dialects/mysql/query-generator.js on lines 143..146

                          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 3 locations. Consider refactoring.
                          Open

                                if (typeof indexName !== "string") {
                                  indexName = Utils._.underscored(tableName + '_' + indexNameOrAttributes.join('_'))
                                }
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 2 other locations - About 40 mins to fix
                          lib/dialects/mysql/query-generator.js on lines 301..303
                          lib/dialects/sqlite/query-generator.js on lines 336..338

                          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

                                var onlyAttributeNames = attributes.map(function(attribute) {
                                  return (typeof attribute === "string") ? attribute : attribute.attribute
                                }.bind(this))
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 40 mins to fix
                          lib/dialects/mysql/query-generator.js on lines 271..273

                          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

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

                                return Utils._.template(query)({
                                  tableName:  this.quoteIdentifiers(tableName),
                                  attributes: attrString.join(', ')
                                })
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 35 mins to fix
                          lib/dialects/postgres/query-generator.js on lines 154..156

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

                          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

                                var pks = primaryKeys[tableName].map(function(pk){
                                  return this.quoteIdentifier(pk)
                                }.bind(this)).join(",")
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 35 mins to fix
                          lib/dialects/postgres/query-generator.js on lines 331..333

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

                          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

                                  pks = primaryKeys[tableName].map(function(pk) {
                                    return this.quoteIdentifier(pk)
                                  }.bind(this)).join(',')
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 35 mins to fix
                          lib/dialects/postgres/query-generator.js on lines 87..89

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

                          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

                                return Utils._.template(query)({
                                  tableName:  this.quoteIdentifiers(tableName),
                                  attributes: attrString.join(', ') })
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 35 mins to fix
                          lib/dialects/postgres/query-generator.js on lines 264..267

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

                          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

                                var schema            = (!!opts.options && !!opts.options.schema ? opts.options.schema : undefined)
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 30 mins to fix
                          lib/dialects/postgres/query-generator.js on lines 16..16

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

                          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

                                var schemaDelimiter   = (!!opts.options && !!opts.options.schemaDelimiter ? opts.options.schemaDelimiter : undefined)
                          Severity: Minor
                          Found in lib/dialects/postgres/query-generator.js and 1 other location - About 30 mins to fix
                          lib/dialects/postgres/query-generator.js on lines 15..15

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

                          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