cb1kenobi/double-stack

View on GitHub

Showing 5 of 5 total issues

Function wrap has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

function wrap(originalFunction, callbackPositions, embedStack, isConstructor) {
    const fn = function () {
        let traceError = new Error();

        // capture the stack
Severity: Minor
Found in src/double-stack.js - About 5 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 wrap has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wrap(originalFunction, callbackPositions, embedStack, isConstructor) {
    const fn = function () {
        let traceError = new Error();

        // capture the stack
Severity: Major
Found in src/double-stack.js - About 3 hrs to fix

    Function fn has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const fn = function () {
            let traceError = new Error();
    
            // capture the stack
            const orig = Error.prepareStackTrace;
    Severity: Major
    Found in src/double-stack.js - About 3 hrs to fix

      Function processStackTrace has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function processStackTrace(error, stack, recursing) {
          let cache = error.__cached_trace__;
      
          if (!cache) {
              cache = [];
      Severity: Minor
      Found in src/double-stack.js - 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

      Function getActiveHandles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports.getActiveHandles = function getActiveHandles() {
          const handles = { sockets: [], servers: [], timers: [], childProcesses: [], fsWatchers: [], other: [] };
      
          for (let handle of process._getActiveHandles()) {
              if (handle instanceof Timer) {
      Severity: Minor
      Found in src/double-stack.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

      Severity
      Category
      Status
      Source
      Language