grantcarthew/node-perj

View on GitHub
src/notation-copy.js

Summary

Maintainability
A
1 hr
Test Coverage

Function notationCopy has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Wontfix

function notationCopy (target, ...sources) {
  let convertBuffer = false
  if (typeof Buffer !== 'undefined') { convertBuffer = true }
  const maxCalls = 2000
  let calls
Severity: Minor
Found in src/notation-copy.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 notationCopy has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

function notationCopy (target, ...sources) {
  let convertBuffer = false
  if (typeof Buffer !== 'undefined') { convertBuffer = true }
  const maxCalls = 2000
  let calls
Severity: Major
Found in src/notation-copy.js - About 2 hrs to fix

    Function notationCopyRecursive has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

      function notationCopyRecursive (tgt, src) {
        if (calls++ > maxCalls) { return }
        if (src == null) { return src }
        const type = typeof src
        if (type === 'string' ||
    Severity: Major
    Found in src/notation-copy.js - About 2 hrs to fix

      Avoid too many return statements within this function.
      Open

              return newArray
      Severity: Major
      Found in src/notation-copy.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Wontfix

            return undefined
        Severity: Major
        Found in src/notation-copy.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Wontfix

                  return tgt
          Severity: Major
          Found in src/notation-copy.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return result
            Severity: Major
            Found in src/notation-copy.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Wontfix

                    return tgt
              Severity: Major
              Found in src/notation-copy.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Wontfix

                        return src
                Severity: Major
                Found in src/notation-copy.js - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status