rjrodger/eraro

View on GitHub
eraro.js

Summary

Maintainability
A
0 mins
Test Coverage

Function eraro has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Invalid

function eraro(options) {
  options = options || {}

  const msgprefix =
    false === options.prefix
Severity: Minor
Found in eraro.js - 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 callpoint has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Invalid

function callpoint(error, markers) {
  markers = Array.isArray(markers) ? markers : []

  const stack = error ? error.stack : null
  let out = ''
Severity: Minor
Found in eraro.js - About 3 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 eraro has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Invalid

function eraro(options) {
  options = options || {}

  const msgprefix =
    false === options.prefix
Severity: Major
Found in eraro.js - About 3 hrs to fix

    Function errormaker has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Invalid

      const errormaker = function (ex, code, msg, details) {
        if (Util.isError(ex)) {
          if (ex.eraro && !options.override) {
            return ex
          }
    Severity: Major
    Found in eraro.js - About 2 hrs to fix

      Function buildmessage has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Invalid

        options,
        msg,
        msgmap,
        msgprefix,
        _inspect,
      Severity: Major
      Found in eraro.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Invalid

                  if (found) break
        Severity: Major
        Found in eraro.js - About 45 mins to fix

          Function buildmessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Invalid

          function buildmessage(
            options,
            msg,
            msgmap,
            msgprefix,
          Severity: Minor
          Found in eraro.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

          There are no issues that match your filters.

          Category
          Status