senecajs/seneca

View on GitHub
lib/common.ts

Summary

Maintainability
D
2 days
Test Coverage

Function makedie has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

function makedie(instance: any, ctxt: any) {
  ctxt = Object.assign(ctxt, instance.die ? instance.die.context : {})

  let diecount = 0

Severity: Minor
Found in lib/common.ts - About 1 day 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 jsonic_strify has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

function jsonic_strify(val: any, opts: any, depth: number) {
  depth++
  if (null == val) return 'null'

  var type = Object.prototype.toString.call(val).charAt(8)
Severity: Minor
Found in lib/common.ts - About 7 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 make_plugin_key has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function make_plugin_key(plugin: any, origtag: any) {
  if (null == plugin) {
    throw error('missing_plugin_name')
  }

Severity: Minor
Found in lib/common.ts - 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

Avoid deeply nested control flow statements.
Open

        if (null != str) {
          out.push(str)
        }
Severity: Major
Found in lib/common.ts - About 45 mins to fix

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

      actdef: any,
      msg: any,
      meta: any,
      origmsg: any,
      ctxt: any
    Severity: Minor
    Found in lib/common.ts - About 35 mins to fix

      Avoid too many return statements within this function.
      Open

          return isNaN(val) ? 'null' : val.toString()
      Severity: Major
      Found in lib/common.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return '{' + out.join(',') + '}'
        Severity: Major
        Found in lib/common.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return '[' + out.join(',') + ']'
          Severity: Major
          Found in lib/common.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return valstr
            Severity: Major
            Found in lib/common.ts - About 30 mins to fix

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

                place(this: any, timelimit: any) {
                  let i = this._list.length
                  let s = 0
                  let e = i
              
              
              Severity: Minor
              Found in lib/common.ts - 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

              There are no issues that match your filters.

              Category
              Status