lebretr/sequelize-oracle

View on GitHub

Showing 575 of 575 total issues

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

      var query = [
        this.createTableQuery(backupTableName, attributes).replace('CREATE TABLE', 'CREATE TEMPORARY TABLE'),
        "INSERT INTO <%= tableName %>_backup SELECT <%= attributeNamesImport %> FROM <%= tableName %>;",
        "DROP TABLE <%= tableName %>;",
        this.createTableQuery(tableName, attributes),
Severity: Minor
Found in lib/dialects/sqlite/query-generator.js and 1 other location - About 40 mins to fix
lib/dialects/sqlite/query-generator.js on lines 356..363

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

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

    if (this.options.logging === true) {
      console.log('DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log')
      this.options.logging = console.log
    }
Severity: Major
Found in lib/migrator.js and 2 other locations - About 40 mins to fix
lib/dialects/abstract/query.js on lines 35..38
lib/sequelize.js on lines 99..102

Duplicated Code

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

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

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

Tuning

This issue has a mass of 49.

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

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

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

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

Refactorings

Further Reading

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

    removeColumnQuery: function(tableName, attributeName) {
      var query = "ALTER TABLE `<%= tableName %>` DROP `<%= attributeName %>`;"
      return Utils._.template(query)({ tableName: tableName, attributeName: attributeName })
    },
Severity: Minor
Found in lib/dialects/mysql/query-generator.js and 1 other location - About 40 mins to fix
lib/dialects/postgres/query-generator.js on lines 549..555

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

Consider simplifying this complex logical expression.
Open

            if (!!this.callee.daoFactory && !!this.callee.daoFactory.rawAttributes && !!this.callee.daoFactory.rawAttributes[key] && !!this.callee.daoFactory.rawAttributes[key].type && !!this.callee.daoFactory.rawAttributes[key].type.type && this.callee.daoFactory.rawAttributes[key].type.type === DataTypes.HSTORE.type) {
              record = hstore.parse(record)
            }
Severity: Major
Found in lib/dialects/postgres/query.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

              if (modelAttributes && modelAttributes[key] && modelAttributes[key].autoIncrement === true && !value) {
                if (this._dialect.supports['DEFAULT']) {
                  values.push('DEFAULT')
                } else {
                  values.push(this.escape(null))
    Severity: Major
    Found in lib/dialects/abstract/query-generator.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                if (Utils._.isString(item) || item instanceof Utils.fn || item instanceof Utils.col || item instanceof Utils.literal || item instanceof Utils.cast || 'raw' in item) {
                  break
                }
      Severity: Major
      Found in lib/dialects/abstract/query-generator.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

              if (columnValues.hasOwnProperty('unique') && columnValues.unique !== true && columnValues.unique !== false) {
                var idxName = columnValues.unique
                if (typeof columnValues.unique === "object") {
                  idxName = columnValues.unique.name
                }
        Severity: Major
        Found in lib/dao-factory.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

              if ((attrValue === undefined || attrValue === null || attrValue === '') && (value === undefined || value === null || value === '')) {
                return false
              }
          Severity: Major
          Found in lib/utils.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                        if (!!this.callee.daoFactory && !!this.callee.daoFactory.rawAttributes && !!this.callee.daoFactory.rawAttributes[key] && !!this.callee.daoFactory.rawAttributes[key].type && !!this.callee.daoFactory.rawAttributes[key].type.type && this.callee.daoFactory.rawAttributes[key].type.type === DataTypes.HSTORE.type) {
                          record = hstore.parse(record)
                        }
            Severity: Major
            Found in lib/dialects/postgres/query.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                          if (isEnum && isMySQL && ciCollation && (attrName in values) && values[attrName]) {
                            var scopeIndex = (definition.values || []).map(function(d) { return d.toLowerCase() }).indexOf(values[attrName].toLowerCase())
                            valueOutOfScope = scopeIndex === -1
              
                            // We'll return what the actual case will be, since a simple SELECT query would do the same...
              Severity: Major
              Found in lib/dao.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                  else if (arguments.length < 3 && typeof arguments[1] === "object") {
                    timeZone = stringifyObjects.timeZone || stringifyObjects.zone || null
                    dialect = stringifyObjects.dialect || null
                    field = stringifyObjects.field || null
                  }
                Severity: Major
                Found in lib/sql-string.js - About 40 mins to fix

                  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/sqlite/query-generator.js and 2 other locations - About 40 mins to fix
                  lib/dialects/mysql/query-generator.js on lines 301..303
                  lib/dialects/postgres/query-generator.js on lines 401..403

                  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/mysql/query-generator.js and 1 other location - About 40 mins to fix
                  lib/dialects/postgres/query-generator.js on lines 374..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 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

                  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

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

                          instance[self.accessors.get](options)
                            .error(function(err) { customEventEmitter.emit('error', err) })
                            .success(function(associatedObjects) {
                              customEventEmitter.emit('success',
                                Utils._.all(objects, function(o) {
                  Severity: Minor
                  Found in lib/associations/has-many.js and 1 other location - About 40 mins to fix
                  lib/associations/has-many.js on lines 239..249

                  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

                          instance[self.accessors.get](options)
                          .error(function(err){ customEventEmitter.emit('error', err)})
                          .success(function(associatedObjects) {
                            customEventEmitter.emit('success',
                              Utils._.any(associatedObjects, function(associatedObject) {
                  Severity: Minor
                  Found in lib/associations/has-many.js and 1 other location - About 40 mins to fix
                  lib/associations/has-many.js on lines 219..231

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

                        if (typeof indexName !== 'string') {
                          indexName = Utils._.underscored(tableName + '_' + indexNameOrAttributes.join('_'))
                        }
                  Severity: Minor
                  Found in lib/dialects/mysql/query-generator.js and 2 other locations - About 40 mins to fix
                  lib/dialects/postgres/query-generator.js on lines 401..403
                  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

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

                      arrayValue: function(value, key, _key, factory, logicResult){
                  Severity: Minor
                  Found in lib/dialects/abstract/query-generator.js - About 35 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
                      Severity
                      Category
                      Status
                      Source
                      Language