sequelize/sequelize

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

Summary

Maintainability
F
1 wk
Test Coverage

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

const _ = require('lodash');

const Utils = require('../../utils');
const DataTypes = require('../../data-types');
const Transaction = require('../../transaction');
Severity: Major
Found in src/dialects/abstract/query-interface.js - About 1 day to fix

    QueryInterface has 52 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class QueryInterface {
      constructor(sequelize, queryGenerator) {
        this.sequelize = sequelize;
        this.queryGenerator = queryGenerator;
      }
    Severity: Major
    Found in src/dialects/abstract/query-interface.js - About 7 hrs to fix

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

        async rawSelect(tableName, options, attributeSelector, Model) {
          options = Utils.cloneDeep(options);
          options = _.defaults(options, {
            raw: true,
            plain: true,
      Severity: Minor
      Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

        async delete(instance, tableName, identifier, options) {
          const cascades = [];
          const sql = this.queryGenerator.deleteQuery(tableName, identifier, {}, instance.constructor);
      
          options = { ...options };
      Severity: Minor
      Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function rawSelect has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async rawSelect(tableName, options, attributeSelector, Model) {
          options = Utils.cloneDeep(options);
          options = _.defaults(options, {
            raw: true,
            plain: true,
      Severity: Minor
      Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

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

          async upsert(tableName, insertValues, updateValues, where, options) {
            options = { ...options };
        
            const model = options.model;
            const primaryKeys = Object.values(model.primaryKeys).map(item => item.field);
        Severity: Minor
        Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

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

            async describeTable(tableName, options) {
              let schema = null;
              let schemaDelimiter = null;
          
              if (typeof options === 'string') {
          Severity: Minor
          Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

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

              async describeTable(tableName, options) {
                let schema = null;
                let schemaDelimiter = null;
            
                if (typeof options === 'string') {
            Severity: Minor
            Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Function delete has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async delete(instance, tableName, identifier, options) {
                const cascades = [];
                const sql = this.queryGenerator.deleteQuery(tableName, identifier, {}, instance.constructor);
            
                options = { ...options };
            Severity: Minor
            Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

              Function createTable has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async createTable(tableName, attributes, options, model) {
                  let sql = '';
              
                  options = { ...options };
              
              
              Severity: Minor
              Found in src/dialects/abstract/query-interface.js - About 1 hr to fix

                Function createTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  async createTable(tableName, attributes, options, model) {
                    let sql = '';
                
                    options = { ...options };
                
                
                Severity: Minor
                Found in src/dialects/abstract/query-interface.js - About 55 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

                Consider simplifying this complex logical expression.
                Open

                    if (!tableName.schema && (options.schema || (!!model && model._schema))) {
                      tableName = this.queryGenerator.addSchema({
                        tableName,
                        _schema: (!!model && model._schema) || options.schema
                      });
                Severity: Major
                Found in src/dialects/abstract/query-interface.js - About 40 mins to fix

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

                    async upsert(tableName, insertValues, updateValues, where, options) {
                      options = { ...options };
                  
                      const model = options.model;
                      const primaryKeys = Object.values(model.primaryKeys).map(item => item.field);
                  Severity: Minor
                  Found in src/dialects/abstract/query-interface.js - About 35 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

                            return new Date(result);
                    Severity: Major
                    Found in src/dialects/abstract/query-interface.js - About 30 mins to fix

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

                        async decrement(model, tableName, where, incrementAmountsByField, extraAttributesToBeUpdated, options) {
                          options = Utils.cloneDeep(options);
                      
                          const sql = this.queryGenerator.arithmeticQuery(
                            '-',
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 3 hrs to fix
                      src/dialects/abstract/query-interface.js on lines 982..998

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

                      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

                        async increment(model, tableName, where, incrementAmountsByField, extraAttributesToBeUpdated, options) {
                          options = Utils.cloneDeep(options);
                      
                          const sql = this.queryGenerator.arithmeticQuery(
                            '+',
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 3 hrs to fix
                      src/dialects/abstract/query-interface.js on lines 1000..1016

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

                      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 (typeof options === 'string') {
                            schema = options;
                          } else if (typeof options === 'object' && options !== null) {
                            schema = options.schema || null;
                            schemaDelimiter = options.schemaDelimiter || null;
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/sqlite/query-interface.js on lines 184..189

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

                      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

                        async createTrigger(
                          tableName,
                          triggerName,
                          timingType,
                          fireOnArray,
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 1141..1156

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

                      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

                        async createFunction(functionName, params, returnType, language, body, optionsArray, options) {
                          const sql = this.queryGenerator.createFunction(
                            functionName,
                            params,
                            returnType,
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 1061..1084

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

                      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

                        async renameTable(before, after, options) {
                          options = options || {};
                          const sql = this.queryGenerator.renameTableQuery(before, after);
                          return await this.sequelize.query(sql, options);
                        }
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 636..640

                      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

                        async removeIndex(tableName, indexNameOrAttributes, options) {
                          options = options || {};
                          const sql = this.queryGenerator.removeIndexQuery(tableName, indexNameOrAttributes);
                          return await this.sequelize.query(sql, options);
                        }
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 287..291

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

                        async dropSchema(schema, options) {
                          options = options || {};
                          const sql = this.queryGenerator.dropSchema(schema);
                          return await this.sequelize.query(sql, options);
                        }
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 2 other locations - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 44..48
                      src/dialects/abstract/query-interface.js on lines 58..62

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 63.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async createSchema(schema, options) {
                          options = options || {};
                          const sql = this.queryGenerator.createSchema(schema);
                          return await this.sequelize.query(sql, options);
                        }
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 2 other locations - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 44..48
                      src/dialects/abstract/query-interface.js on lines 72..76

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 63.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async dropDatabase(database, options) {
                          options = options || {};
                          const sql = this.queryGenerator.dropDatabaseQuery(database);
                          return await this.sequelize.query(sql, options);
                        }
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 2 other locations - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 58..62
                      src/dialects/abstract/query-interface.js on lines 72..76

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 63.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async renameFunction(oldFunctionName, params, newFunctionName, options) {
                          const sql = this.queryGenerator.renameFunction(oldFunctionName, params, newFunctionName);
                          options = options || {};
                      
                          if (sql) {
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 1095..1102

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 62.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async renameTrigger(tableName, oldTriggerName, newTriggerName, options) {
                          const sql = this.queryGenerator.renameTrigger(tableName, oldTriggerName, newTriggerName);
                          options = options || {};
                      
                          if (sql) {
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 1205..1212

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 62.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async dropFunction(functionName, params, options) {
                          const sql = this.queryGenerator.dropFunction(functionName, params);
                          options = options || {};
                      
                          if (sql) {
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 1086..1093

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 61.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async dropTrigger(tableName, triggerName, options) {
                          const sql = this.queryGenerator.dropTrigger(tableName, triggerName);
                          options = options || {};
                      
                          if (sql) {
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 1176..1183

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 61.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async showIndex(tableName, options) {
                          const sql = this.queryGenerator.showIndexesQuery(tableName, options);
                          return await this.sequelize.query(sql, {
                            ...options,
                            type: QueryTypes.SHOWINDEXES
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 737..743

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 55.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        async showConstraint(tableName, constraintName, options) {
                          const sql = this.queryGenerator.showConstraintsQuery(tableName, constraintName);
                          return await this.sequelize.query(sql, {
                            ...options,
                            type: QueryTypes.SHOWCONSTRAINTS
                      Severity: Major
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 1 hr to fix
                      src/dialects/abstract/query-interface.js on lines 558..564

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 55.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          try {
                            const data = await this.sequelize.query(sql, options);
                            /*
                             * If no data is returned from the query, then the table name may be wrong.
                             * Query generators that use information_schema for retrieving table info will just return an empty result set,
                      Severity: Minor
                      Found in src/dialects/abstract/query-interface.js and 1 other location - About 55 mins to fix
                      src/dialects/sqlite/query-interface.js on lines 200..242

                      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

                      There are no issues that match your filters.

                      Category
                      Status