rjrodger/gubu

View on GitHub

Showing 8 of 70 total issues

Function Exact has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const Exact = function(this: any, ...vals: any[]) {
  let node = buildize()

  node.b.push(function Exact(val: any, update: Update, state: State) {
    for (let i = 0; i < vals.length; i++) {
Severity: Minor
Found in gubu.ts - 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

Consider simplifying this complex logical expression.
Open

        else if (!(
          S.any === s.type ||
          S.list === s.type ||
          undefined === s.val ||
          s.type === s.valType ||
Severity: Critical
Found in gubu.ts - About 1 hr to fix

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

    const Exact = function(this: any, ...vals: any[]) {
      let node = buildize()
    
      node.b.push(function Exact(val: any, update: Update, state: State) {
        for (let i = 0; i < vals.length; i++) {
    Severity: Minor
    Found in gubu.ts - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                if (n.r && valundef) {
                  s.ignoreVal = true
                  s.curerr.push(makeErrImpl(S.required, s, 1030))
                }
                else if (!valundef && !isarr(s.val)) {
      Severity: Major
      Found in gubu.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                else if (S.regexp === s.type) {
                  if (valundef && !n.r) {
                    s.ignoreVal = true
                  }
                  else if (S.string !== s.valType) {
        Severity: Major
        Found in gubu.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      for (let eI = 0; eI < s.err.length; eI++) {
                        if (s.err[eI].k === fromDflt.key) {
                          s.err.splice(eI, 1)
                          eI--
                        }
          Severity: Major
          Found in gubu.ts - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (!keep) {
                          delete s.parent[cn]
                        }
                        else {
                          let j = s.cI + 1
            Severity: Major
            Found in gubu.ts - About 45 mins to fix

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

              function node2str(n: Node<any>): string {
                return (null != n.s && '' !== n.s) ? n.s :
                  (!n.r && undefined !== n.v) ?
                    ('function' === typeof n.v.constructor ? n.v : n.v.toString())
                    : n.t
              Severity: Minor
              Found in gubu.ts - 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

              Severity
              Category
              Status
              Source
              Language