Showing 2,859 of 2,859 total issues

Function newSection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function newSection(tok) {
  var section = {};
  // infer the type from the text.
  var text = section.textRaw = tok.text;
  if (text.match(eventExpr)) {
Severity: Minor
Found in tools/doc/json.js - About 45 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 (!self.paused) {
                // Stream must be paused and resumed after SIGCONT to catch
                // SIGINT, SIGTSTP, and EOF.
                self.pause();
                self.emit('SIGCONT');
Severity: Major
Found in lib/readline.js - About 45 mins to fix

    Function socketOnData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function socketOnData(d) {
      var socket = this;
      var req = this._httpMessage;
      var parser = this.parser;
    
    
    Severity: Minor
    Found in lib/_http_client.js - About 45 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 (this._sawReturn)
              this._sawReturn = false;
            else
              this._line();
    Severity: Major
    Found in lib/readline.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (match.index === posWithinLine) {
                  break;
                }
      Severity: Major
      Found in doc/sh_main.js - About 45 mins to fix

        Function stableSort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function stableSort(array, compare) {
          assert(Array.isArray(array), 'array must be an array');
        
          if (!compare) {
            compare = defaultCompare;
        Severity: Minor
        Found in tools/common.js - About 45 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 (base.match(/-\d+\.\d+(\.\d+)?/) || name === '.npm') {
                  // Exclude versioned names that 'npm' installs.
                  continue;
                }
        Severity: Major
        Found in lib/repl.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                  if (util.isBuffer(s))
                    s = s.toString('utf-8');
          Severity: Major
          Found in lib/readline.js - About 45 mins to fix

            Function processCmdLineArgs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function processCmdLineArgs() {
              var cmdLineOpts = {};
            
              var cmdLineArgs = process.argv.splice(2);
              for (var i = 0; i < cmdLineArgs.length; ++i) {
            Severity: Minor
            Found in tools/update-authors.js - About 45 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 (line.length === 0) {
                    filter = '';
                    expr = '';
                  } else if (line[line.length - 1] === '.') {
                    filter = '';
            Severity: Major
            Found in lib/repl.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (tmp < 0) {
                            //more to go, recurse
                            depth += curr.depth;
                            workIt();
                          } else if (tmp > 0) {
              Severity: Major
              Found in lib/repl.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          for (var subexpression = 0; subexpression < newStyle.length; subexpression++) {
                            matchedString = bestMatch[subexpression + 1];
                            output(matchedString, newStyle[subexpression]);
                          }
                Severity: Major
                Found in doc/sh_main.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                          if (exts.indexOf(ext) !== -1) {
                            if (!subdir || base !== 'index') {
                              group.push(subdir + base);
                            }
                          } else {
                  Severity: Major
                  Found in lib/repl.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                          if (!expr) {
                            // If context is instance of vm.ScriptContext
                            // Get global vars synchronously
                            if (this.useGlobal ||
                                this.context.constructor &&
                    Severity: Major
                    Found in lib/repl.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if (r.source === '$') {
                                  r.exec = sh_konquerorExec;
                                }
                      Severity: Major
                      Found in doc/sh_main.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                if (s) {
                                  var lines = s.split(/\r\n|\n|\r/);
                                  for (var i = 0, len = lines.length; i < len; i++) {
                                    if (i > 0) {
                                      this._line();
                        Severity: Major
                        Found in lib/readline.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (q < t) {
                                                      break;
                                                  }
                          Severity: Major
                          Found in lib/punycode.js - About 45 mins to fix

                            Function send has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            Socket.prototype.send = function(buffer,
                                                             offset,
                                                             length,
                                                             port,
                                                             address,
                            Severity: Minor
                            Found in lib/dgram.js - About 45 mins to fix

                              Function concat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              Buffer.concat = function(list, length) {
                                if (!util.isArray(list))
                                  throw new TypeError('list argument must be an Array of Buffers.');
                              
                                if (util.isUndefined(length)) {
                              Severity: Minor
                              Found in lib/buffer.js - About 45 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

                                        for (var j = 0, k = part.length; j < k; j++) {
                                          if (part.charCodeAt(j) > 127) {
                                            // we replace non-ASCII char with a temporary placeholder
                                            // we need this to make sure size of hostname is not
                                            // broken by replacing non-ASCII by nothing
                              Severity: Major
                              Found in lib/url.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language