getraddished/raddish-db

View on GitHub

Showing 10 of 32 total issues

Function buildSelect has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    buildSelect(query) {
        var sql = 'SELECT ',
            columns = query.query.columns,
            cols = [],
            joins = query.query.join;
Severity: Minor
Found in lib/builders/mysql.js - About 2 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 _buildQwhereClause has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    _buildQwhereClause(query, wheres, from) {
        for(var where of wheres) {
            if(from && from.alias) {
                where.column = where.column.replace(from.alias + '.', '');
            }
Severity: Minor
Found in lib/builders/mongo.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 getColumns has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getColumns(table) {
        var self = this;

        return this.getConnection()
            .then(function(connection) {
Severity: Minor
Found in lib/adapters/mongo.js - About 1 hr to fix

    Function buildSelect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        buildSelect(query) {
            var sql = 'SELECT ',
                columns = query.query.columns,
                cols = [],
                joins = query.query.join;
    Severity: Minor
    Found in lib/builders/mysql.js - About 1 hr to fix

      Function Wherable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Wherable = function(parent) {
              return class extends parent {
                  /**
                   * The where function will add a filter to the query.
                   *
      Severity: Minor
      Found in lib/query/abstract.js - About 1 hr to fix

        Function _buildQwhereClause has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _buildQwhereClause(query, wheres, from) {
                for(var where of wheres) {
                    if(from && from.alias) {
                        where.column = where.column.replace(from.alias + '.', '');
                    }
        Severity: Minor
        Found in lib/builders/mongo.js - About 1 hr to fix

          Function select has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              select(name, alias) {
                  this.last = 'select';
          
                  if(name.toString() === '[object Object]') {
                      for(var index in name) {
          Severity: Minor
          Found in lib/query/select.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 getInstance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              getInstance(instance) {
                  if(!this.instances[instance]) {
                      var config = this.config[instance];
          
                      if(!config) {
          Severity: Minor
          Found in index.js - About 45 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

          Function _buildWhereClause has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              _buildWhereClause(wheres) {
                  var sql = '';
          
                  if(wheres.length) {
                      sql += ' WHERE';
          Severity: Minor
          Found in lib/builders/mysql.js - About 25 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

          Function _buildHavingClause has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              _buildHavingClause(havings) {
                  var sql = '';
          
                  if(havings.length) {
                      sql += ' HAVING';
          Severity: Minor
          Found in lib/builders/mysql.js - About 25 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

          Severity
          Category
          Status
          Source
          Language