maskit/h2cli

View on GitHub

Showing 41 of 78 total issues

Function consumeFrame has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

Stream.prototype.consumeFrame = function (frame) {
    this.stat.received += frame.getBuffer().length;
    this.emit('frame', frame);
    if (frame.streamId > 0) {
        switch (this.state) {
Severity: Minor
Found in lib/stream.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 consumeFrame has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Stream.prototype.consumeFrame = function (frame) {
    this.stat.received += frame.getBuffer().length;
    this.emit('frame', frame);
    if (frame.streamId > 0) {
        switch (this.state) {
Severity: Major
Found in lib/stream.js - About 4 hrs to fix

    Function exec has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        'exec': function (args, callback) {
            if (!args[1]) {
                console.log('usage: get URL');
                console.log('');
                console.log('You can specify authority by using format below.');
    Severity: Minor
    Found in lib/cmd/get.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 send has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Stream.prototype.send = function (frames, callback) {
        if (!(frames instanceof Array)) {
            frames = [frames];
        }
        var self = this;
    Severity: Major
    Found in lib/stream.js - About 3 hrs to fix

      Function printFrame has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports.printFrame = function (frame, verbose) {
          var str = frame.toString();
      
          if (verbose) {
              var flags = [];
      Severity: Minor
      Found in lib/util.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 printFrame has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.printFrame = function (frame, verbose) {
          var str = frame.toString();
      
          if (verbose) {
              var flags = [];
      Severity: Major
      Found in lib/util.js - About 3 hrs to fix

        Function Connection has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Connection = module.exports.Connection = function (hostname, port, options) {
            var self = this;
            this.hostname = hostname;
            this.port     = port;
            this.secure   = options.secure;
        Severity: Major
        Found in lib/connection.js - About 3 hrs to fix

          File h2.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          var util = require('util');
          var events = require('events');
          var h2connection = require('./connection');
          var h2frame = require('./frame');
          var h2util = require('./util');
          Severity: Minor
          Found in lib/h2.js - About 3 hrs to fix

            Function exec has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                'exec': function (args, callback) {
                    if (!args[1]) {
                        console.log('usage: get URL');
                        console.log('');
                        console.log('You can specify authority by using format below.');
            Severity: Major
            Found in lib/cmd/get.js - About 2 hrs to fix

              Function exec has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  'exec': function (args, callback) {
                      if (!args[1]) {
                          console.log('usage: head URL');
                          console.log('');
                          console.log('You can specify authority by using format below.');
              Severity: Minor
              Found in lib/cmd/head.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 request has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              H2.prototype.request = function (/* authority, path, method, data, callbacks */) {
                  var self = this, authority, path, method, data, callbacks, pos, i, f;
                  pos = 0;
                  if (arguments[0][0] === '/') {
                      authority = self.connection ? self.connection.hostname : '';
              Severity: Minor
              Found in lib/h2.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 request has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              H2.prototype.request = function (/* authority, path, method, data, callbacks */) {
                  var self = this, authority, path, method, data, callbacks, pos, i, f;
                  pos = 0;
                  if (arguments[0][0] === '/') {
                      authority = self.connection ? self.connection.hostname : '';
              Severity: Major
              Found in lib/h2.js - About 2 hrs to fix

                Function connect has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                H2.prototype.connect = function (hostname, port, options, callback) {
                    var self = this;
                    if (!options.secure && typeof options.useUpgrade === 'undefined') {
                        options.useUpgrade = self.config['http2.use_upgrade'];
                    }
                Severity: Major
                Found in lib/h2.js - About 2 hrs to fix

                  Function exec has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      'exec': function (args, callback) {
                          if (!args[1]) {
                              console.log('usage: head URL');
                              console.log('');
                              console.log('You can specify authority by using format below.');
                  Severity: Major
                  Found in lib/cmd/head.js - About 2 hrs to fix

                    Function exec has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        'exec': function (args, callback) {
                            switch (args[1]) {
                                case 'settings':
                                    if (this.client.connection) {
                                        console.log('NAME                            | Local | Remote');
                    Severity: Major
                    Found in lib/cmd/show.js - About 2 hrs to fix

                      Function exec has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          'exec': function (args, callback) {
                              if (!args[1]) {
                                  console.log('usage: post URL data');
                                  console.log('');
                                  console.log('You can specify authority by using format below.');
                      Severity: Major
                      Found in lib/cmd/post.js - About 2 hrs to fix

                        Function exec has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            'exec': function (args, callback) {
                                if (!args[1]) {
                                    args[1] = 'http://localhost:8080/';
                                    //args[1] = 'https://nghttp2.org/';
                                    //args[1] = 'http://nghttp2.org/';
                        Severity: Minor
                        Found in lib/cmd/connect.js - About 1 hr to fix

                          Function createCompleter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports.createCompleter = function (hints) {
                              return function (line) {
                                  var args = line.split(' ');
                                  var i, candidates, hits;
                                  candidates = hints;
                          Severity: Minor
                          Found in lib/command.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 exec has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              'exec': function (args, callback) {
                                  if (!args[1]) {
                                      console.log('usage: post URL data');
                                      console.log('');
                                      console.log('You can specify authority by using format below.');
                          Severity: Minor
                          Found in lib/cmd/post.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 exports has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          var Http2HeadersFrame = module.exports = function (buf) {
                              if (!(this instanceof Http2HeadersFrame)) {
                                  return new Http2HeadersFrame(buf);
                              }
                              if (buf) {
                          Severity: Minor
                          Found in lib/frame/headers.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