lebretr/sequelize-oracle

View on GitHub

Showing 575 of 575 total issues

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

Mixin.hasOne = function(associatedDAOFactory, options) {
  // Since this is a mixin, we'll need a unique variable name for hooks (since DAOFactory will override our hooks option)
  options = options || {}
  options.hooks = options.hooks === undefined ? false : Boolean(options.hooks)
  options.useHooks = options.hooks
Severity: Major
Found in lib/associations/mixin.js and 1 other location - About 1 day to fix
lib/associations/mixin.js on lines 26..41

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

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

Mixin.belongsTo = function(associatedDAOFactory, options) {
  // Since this is a mixin, we'll need a unique variable name for hooks (since DAOFactory will override our hooks option)
  options = options || {}
  options.hooks = options.hooks === undefined ? false : Boolean(options.hooks)
  options.useHooks = options.hooks
Severity: Major
Found in lib/associations/mixin.js and 1 other location - About 1 day to fix
lib/associations/mixin.js on lines 9..24

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

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

File utils.js has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var util               = require("util")
  , DataTypes          = require("./data-types")
  , SqlString          = require("./sql-string")
  , lodash             = require("lodash")
  , _string            = require('underscore.string')
Severity: Major
Found in lib/utils.js - About 1 day to fix

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

    module.exports = (function() {
      var ConnectorManager = function(sequelize, config) {
        var pgModule = config.dialectModulePath || 'pg'
    
        this.sequelize = sequelize
    Severity: Minor
    Found in lib/dialects/postgres/connector-manager.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

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

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

    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

    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

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

        deleteQuery: function(tableName, where, options) {
          options = options || {}
    
          var table = this.quoteIdentifier(tableName)
          if (options.truncate === true) {
    Severity: Major
    Found in lib/dialects/mysql/query-generator.js and 1 other location - About 7 hrs to fix
    lib/dialects/oracle/query-generator.js on lines 191..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 177.

    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

        deleteQuery: function(tableName, where, options) {
          options = options || {}
    
          var table = this.quoteIdentifier(tableName)
          if (options.truncate === true) {
    Severity: Major
    Found in lib/dialects/oracle/query-generator.js and 1 other location - About 7 hrs to fix
    lib/dialects/mysql/query-generator.js on lines 212..233

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

    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

    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/mysql/query-generator.js and 1 other location - About 6 hrs to fix
    lib/dialects/postgres/query-generator.js on lines 350..372

    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

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

    module.exports = (function() {
      var HasManyDoubleLinked = function(association, instance) {
        this.association = association
        this.instance = instance
    
    
    Severity: Major
    Found in lib/associations/has-many-double-linked.js - About 6 hrs to fix

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

                if(dataType.references) {
                  template += " REFERENCES " + this.quoteIdentifier(dataType.references)
      
                  if(dataType.referencesKey) {
                    template += " (" + this.quoteIdentifier(dataType.referencesKey) + ")"
      Severity: Major
      Found in lib/dialects/mysql/query-generator.js and 1 other location - About 6 hrs to fix
      lib/dialects/oracle/query-generator.js on lines 300..317

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

      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(dataType.references) {
                  template += " REFERENCES " + this.quoteIdentifier(dataType.references)
      
                  if(dataType.referencesKey) {
                    template += " (" + this.quoteIdentifier(dataType.referencesKey) + ")"
      Severity: Major
      Found in lib/dialects/oracle/query-generator.js and 1 other location - About 6 hrs to fix
      lib/dialects/mysql/query-generator.js on lines 350..367

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

      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

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

      module.exports = (function() {
        var Query = function(database, sequelize, callee, options) {
          this.database = database
          this.sequelize = sequelize
          this.callee = callee
      Severity: Major
      Found in lib/dialects/sqlite/query.js - About 6 hrs to fix

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

        module.exports = (function() {
          var ConnectorManager = function(sequelize, config) {
            var pgModule = config.dialectModulePath || 'pg'
        
            this.sequelize = sequelize
        Severity: Major
        Found in lib/dialects/postgres/connector-manager.js - About 6 hrs to fix

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

              if (this.useReplicaton) {
                var reads = 0
                  , writes = 0;
          
                // Init configs with options from config if not present
          Severity: Major
          Found in lib/dialects/mysql/connector-manager.js and 1 other location - About 5 hrs to fix
          lib/dialects/oracle/connector-manager.js on lines 43..147

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

          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

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

          module.exports = (function() {
            var HasManySingleLinked = function(definition, instance) {
              this.__factory = definition
              this.instance = instance
            }
          Severity: Minor
          Found in lib/associations/has-many-single-linked.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

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

          sequelize.sync({force: true}).on('success', function() {
            user.save().on('success', function(user) {
              console.log("user.isAdmin should be the default value (false): ", user.isAdmin)
              
              user.updateAttributes({ isAdmin: true }).on('success', function(user) {
          Severity: Major
          Found in examples/default-values/app.js and 1 other location - About 5 hrs to fix
          examples/image-handling/app.js on lines 18..28

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

          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

          sequelize.sync({force: true}).on('success', function() {
            user.save().on('success', function(user) {
              console.log("user.isAdmin should be the default value (false): ", user.isAdmin)
          
              user.updateAttributes({ isAdmin: true }).on('success', function(user) {
          Severity: Major
          Found in examples/image-handling/app.js and 1 other location - About 5 hrs to fix
          examples/default-values/app.js on lines 18..28

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

          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

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

            var ConnectorManager = function(sequelize, config) {
              try {
                if (config.dialectModulePath) {
                  mysql = require(config.dialectModulePath)
                } else {
          Severity: Major
          Found in lib/dialects/mysql/connector-manager.js - About 5 hrs to fix
            Severity
            Category
            Status
            Source
            Language