lib/_debugger.js

Summary

Maintainability
F
1 wk
Test Coverage

File _debugger.js has 1185 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Severity: Major
Found in lib/_debugger.js - About 3 days to fix

    Function setBreakpoint has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    Interface.prototype.setBreakpoint = function(script, line,
                                                 condition, silent) {
      if (!this.requireConnection()) return;
    
      var self = this,
    Severity: Minor
    Found in lib/_debugger.js - About 4 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 setBreakpoint has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Interface.prototype.setBreakpoint = function(script, line,
                                                 condition, silent) {
      if (!this.requireConnection()) return;
    
      var self = this,
    Severity: Major
    Found in lib/_debugger.js - About 3 hrs to fix

      Function Interface has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Interface(stdin, stdout, args) {
        var self = this;
      
        this.stdin = stdin;
        this.stdout = stdout;
      Severity: Major
      Found in lib/_debugger.js - About 3 hrs to fix

        Function trySpawn has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Interface.prototype.trySpawn = function(cb) {
          var self = this,
              breakpoints = this.breakpoints || [],
              port = exports.port,
              host = 'localhost',
        Severity: Major
        Found in lib/_debugger.js - About 3 hrs to fix

          Function mirrorObject has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Client.prototype.mirrorObject = function(handle, depth, cb) {
            var self = this;
          
            var val;
          
          
          Severity: Major
          Found in lib/_debugger.js - About 2 hrs to fix

            Function trySpawn has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            Interface.prototype.trySpawn = function(cb) {
              var self = this,
                  breakpoints = this.breakpoints || [],
                  port = exports.port,
                  host = 'localhost',
            Severity: Minor
            Found in lib/_debugger.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 Interface has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function Interface(stdin, stdout, args) {
              var self = this;
            
              this.stdin = stdin;
              this.stdout = stdout;
            Severity: Minor
            Found in lib/_debugger.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

            Function list has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Interface.prototype.list = function(delta) {
              if (!this.requireConnection()) return;
            
              delta || (delta = 5);
            
            
            Severity: Minor
            Found in lib/_debugger.js - About 1 hr to fix

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

              Client.prototype._onResponse = function(res) {
                var cb,
                    index = -1;
              
                this._reqCallbacks.some(function(fn, i) {
              Severity: Minor
              Found in lib/_debugger.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

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

              Interface.prototype.scripts = function() {
                if (!this.requireConnection()) return;
              
                var client = this.client,
                    displayNatives = arguments[0] || false,
              Severity: Minor
              Found in lib/_debugger.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

              Function execute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Protocol.prototype.execute = function(d) {
                var res = this.res;
                res.raw += d;
              
                switch (this.state) {
              Severity: Minor
              Found in lib/_debugger.js - About 1 hr to fix

                Function _onResponse has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Client.prototype._onResponse = function(res) {
                  var cb,
                      index = -1;
                
                  this._reqCallbacks.some(function(fn, i) {
                Severity: Minor
                Found in lib/_debugger.js - About 1 hr to fix

                  Function clearBreakpoint has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Interface.prototype.clearBreakpoint = function(script, line) {
                    if (!this.requireConnection()) return;
                  
                    var ambiguous,
                        breakpoint,
                  Severity: Minor
                  Found in lib/_debugger.js - About 1 hr to fix

                    Function execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Protocol.prototype.execute = function(d) {
                      var res = this.res;
                      res.raw += d;
                    
                      switch (this.state) {
                    Severity: Minor
                    Found in lib/_debugger.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

                    Consider simplifying this complex logical expression.
                    Open

                      if (cb) {
                        this._reqCallbacks.splice(index, 1);
                        handled = true;
                    
                        var err = res.success === false && (res.message || true) ||
                    Severity: Critical
                    Found in lib/_debugger.js - About 1 hr to fix

                      Function backtrace has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Interface.prototype.backtrace = function() {
                        if (!this.requireConnection()) return;
                      
                        var self = this,
                            client = this.client;
                      Severity: Minor
                      Found in lib/_debugger.js - About 1 hr to fix

                        Function watchers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        Interface.prototype.watchers = function() {
                          var self = this,
                              verbose = arguments[0] || false,
                              callback = arguments[1] || function() {},
                              waiting = this._watchers.length,
                        Severity: Minor
                        Found in lib/_debugger.js - About 1 hr to fix

                          Function watchers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Interface.prototype.watchers = function() {
                            var self = this,
                                verbose = arguments[0] || false,
                                callback = arguments[1] || function() {},
                                waiting = this._watchers.length,
                          Severity: Minor
                          Found in lib/_debugger.js - About 55 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

                          Function SourceInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function SourceInfo(body) {
                            var result = body.exception ? 'exception in ' : 'break in ';
                          
                            if (body.script) {
                              if (body.script.name) {
                          Severity: Minor
                          Found in lib/_debugger.js - About 55 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

                          Avoid deeply nested control flow statements.
                          Open

                                    if (scriptId) {
                                      ambiguous = true;
                                    }
                          Severity: Major
                          Found in lib/_debugger.js - About 45 mins to fix

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

                            Client.prototype.mirrorObject = function(handle, depth, cb) {
                              var self = this;
                            
                              var val;
                            
                            
                            Severity: Minor
                            Found in lib/_debugger.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