lebretr/sequelize-oracle

View on GitHub

Showing 575 of 575 total issues

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

module.exports = (function() {
  var QueryChainer = function(emitters) {
    var self = this

    this.finishedEmits  = 0
Severity: Minor
Found in lib/query-chainer.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 generateJoinQueries has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        var generateJoinQueries = function(include, parentTable) {
          var table         = include.daoFactory.tableName
            , as            = include.as
            , joinQueryItem = ""
            , joinQueries = {
Severity: Major
Found in lib/dialects/oracle/query-generator.js - About 4 hrs to fix

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

            var generateJoinQueries = function(include, parentTable) {
              var table         = include.daoFactory.tableName
                , as            = include.as
                , joinQueryItem = ""
                , joinQueries = {
    Severity: Major
    Found in lib/dialects/abstract/query-generator.js - About 4 hrs to fix

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

            if (subQuery) {
              subQueryItems.push("SELECT " + subQueryAttributes.join(', ') + " FROM " + options.table)
              subQueryItems.push(subJoinQueries.join(''))
      
            // Else do it the reguar way
      Severity: Major
      Found in lib/dialects/oracle/query-generator.js and 1 other location - About 4 hrs to fix
      lib/dialects/abstract/query-generator.js on lines 789..797

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

      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 (subQuery) {
              subQueryItems.push("SELECT " + subQueryAttributes.join(', ') + " FROM " + options.table)
              subQueryItems.push(subJoinQueries.join(''))
      
            // Else do it the reguar way
      Severity: Major
      Found in lib/dialects/abstract/query-generator.js and 1 other location - About 4 hrs to fix
      lib/dialects/oracle/query-generator.js on lines 659..667

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

      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

              chainer.runSerially()
              .success(function(results){
                emitter.query = { sql: sql }
                emitter.emit('sql', sql)
                emitter.emit('success', results[1])
      Severity: Major
      Found in lib/query-interface.js and 1 other location - About 4 hrs to fix
      lib/query-interface.js on lines 688..698

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

      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

            chainer.runSerially()
            .success(function(results){
              emitter.query = { sql: sql }
              emitter.emit('sql', sql)
              emitter.emit('success', results[0])
      Severity: Major
      Found in lib/query-interface.js and 1 other location - About 4 hrs to fix
      lib/query-interface.js on lines 658..668

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

      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 109 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

        var Utils       = require("../../utils")
          , DataTypes   = require("../../data-types")
          , SqlString   = require("../../sql-string")
          , Transaction = require("../../transaction")
        
        
        Severity: Minor
        Found in lib/dialects/sqlite/query-generator.js - About 4 hrs to fix

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

          var Utils     = require("../../utils")
            , DataTypes = require("../../data-types")
            , util      = require("util")
          
          module.exports = (function() {
          Severity: Minor
          Found in lib/dialects/mysql/query-generator.js - About 4 hrs to fix

            File connector-manager.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            var mariadb
              , Pooling = require('generic-pool')
              , Query   = require("./query")
              , Utils   = require("../../utils")
              , without = function(arr, elem) { return arr.filter(function(e) { return e != elem }) }
            Severity: Minor
            Found in lib/dialects/mariadb/connector-manager.js - About 4 hrs to fix

              Function update has 105 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                DAOFactory.prototype.update = function(attrValueHash, where, options) {
                  var self  = this
                    , query = null
                    , tick  = 0
              
              
              Severity: Major
              Found in lib/dao-factory.js - About 4 hrs to fix

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

                module.exports = function(sequelize, DataTypes) {
                    return sequelize.define('Video', {
                        title: {
                            type: DataTypes.STRING
                        },
                Severity: Major
                Found in examples/enforce-referential-integrity/models/Video.js and 1 other location - About 4 hrs to fix
                examples/enforce-referential-integrity/models/Series.js on lines 4..26

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

                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

                module.exports = function(sequelize, DataTypes) {
                    return sequelize.define('Series', {
                        title: {
                            type: DataTypes.STRING
                        },
                Severity: Major
                Found in examples/enforce-referential-integrity/models/Series.js and 1 other location - About 4 hrs to fix
                examples/enforce-referential-integrity/models/Video.js on lines 4..26

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

                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

                            queryAndEmit
                              .call(self, sql, 'createTable', options)
                              .success(function(res) {
                                self.emit('createTable', null)
                                emitter.emit('success', res)
                Severity: Major
                Found in lib/query-interface.js and 1 other location - About 4 hrs to fix
                lib/query-interface.js on lines 176..184

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

                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

                        queryAndEmit.call(self, sql, 'createTable', options).success(function(results) {
                          self.emit('createTable', null)
                          emitter.emit('success', results)
                        }).error(function(err) {
                          self.emit('createTable', err)
                Severity: Major
                Found in lib/query-interface.js and 1 other location - About 4 hrs to fix
                lib/query-interface.js on lines 153..165

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

                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 101 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = (function() {
                  var HasManySingleLinked = function(definition, instance) {
                    this.__factory = definition
                    this.instance = instance
                  }
                Severity: Major
                Found in lib/associations/has-many-single-linked.js - About 4 hrs to fix

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

                    QueryInterface.prototype.renameTrigger = function(tableName, oldTriggerName, newTriggerName) {
                      var  sql = this.QueryGenerator.renameTrigger(tableName, oldTriggerName, newTriggerName)
                      if (sql){
                        return queryAndEmit.call(this, sql, 'renameTrigger')
                      } else {
                  Severity: Major
                  Found in lib/query-interface.js and 1 other location - About 3 hrs to fix
                  lib/query-interface.js on lines 843..853

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

                  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

                    QueryInterface.prototype.startTransaction = function(transaction, options) {
                      if (!transaction || !(transaction instanceof Transaction)) {
                        throw new Error('Unable to start a transaction without transaction object!')
                      }
                  
                  
                  Severity: Major
                  Found in lib/query-interface.js and 1 other location - About 3 hrs to fix
                  lib/query-interface.js on lines 913..924

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

                  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

                    QueryInterface.prototype.renameFunction = function(oldFunctionName, params, newFunctionName) {
                      var  sql = this.QueryGenerator.renameFunction(oldFunctionName, params, newFunctionName)
                      if (sql){
                        return queryAndEmit.call(this, sql, 'renameFunction')
                      } else {
                  Severity: Major
                  Found in lib/query-interface.js and 1 other location - About 3 hrs to fix
                  lib/query-interface.js on lines 807..817

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language