adhyapranata/crane

View on GitHub

Showing 8 of 42 total issues

Builder has 126 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Builder {
  constructor (connection = null, grammar = null) {
    this.bindings = {
      select: [],
      join: [],
Severity: Major
Found in src/Builder.js - About 2 days to fix

    File Builder.js has 828 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Database from './Database'
    import Expression from './Expression'
    import {
      isString,
      isBoolean,
    Severity: Major
    Found in src/Builder.js - About 1 day to fix

      Grammar has 94 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class Grammar {
        constructor () {
          this.tablePrefix = ''
          this.operators = []
          this.selectComponents = [
      Severity: Major
      Found in src/Grammar.js - About 1 day to fix

        File Grammar.js has 479 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import Expression from './Expression'
        import { isString, isNull, isUndefined, isObject } from './DataType'
        import { upperCaseFirstLetter } from './Utilities'
        
        export default class Grammar {
        Severity: Minor
        Found in src/Grammar.js - About 7 hrs to fix

          Function where has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            where (column, operator = null, value = null, boolean = 'and') {
              if (Array.isArray(column)) {
                return this.addArrayOfWheres(column, boolean)
              }
          
          
          Severity: Minor
          Found in src/Builder.js - About 1 hr to fix

            Function where has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              where (column, operator = null, value = null, boolean = 'and') {
                if (Array.isArray(column)) {
                  return this.addArrayOfWheres(column, boolean)
                }
            
            
            Severity: Minor
            Found in src/Builder.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 constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor (connection = null, grammar = null) {
                this.bindings = {
                  select: [],
                  join: [],
                  where: [],
            Severity: Minor
            Found in src/Builder.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                  return this
              Severity: Major
              Found in src/Builder.js - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language