maskit/h2cli

View on GitHub

Showing 41 of 78 total issues

Function newStream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

Connection.prototype.newStream = function (id) {
    if (typeof id !== 'undefined') {
        if (id % 2 === 1) {
            if (id > this.highestStreamId) {
                this.highestStreamId = id;
Severity: Minor
Found in lib/connection.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 handleSettingsFrame has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

var handleSettingsFrame = function (stream, frame) {
    var p, i, params, nParam, ackFrame;
    if (frame.flags & h2frame.Http2SettingsFrame.FLAG_ACK) {
        params = this._settingQueue.shift();
        if (params) {
Severity: Minor
Found in lib/h2.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 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    'exec': function (args, callback) {
        var frame;
        switch (args[1]) {
            case 'preface':
                this.client.send(h2.HTTP2_PREFACE, callback);
Severity: Minor
Found in lib/cmd/send.js - About 1 hr to fix

    Function _read has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    Http2Reader.prototype._read = function(n) {
        var chunk = this._source.read();
        if (chunk === null) {
            return this.push('');
        }
    Severity: Minor
    Found in lib/connection.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 10 (exceeds 5 allowed). Consider refactoring.
    Open

        'exec': function (args, callback) {
            switch (args[1]) {
                case 'settings':
                    if (this.client.connection) {
                        console.log('NAME                            | Local | Remote');
    Severity: Minor
    Found in lib/cmd/show.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 _read has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Http2Reader.prototype._read = function(n) {
        var chunk = this._source.read();
        if (chunk === null) {
            return this.push('');
        }
    Severity: Minor
    Found in lib/connection.js - About 1 hr to fix

      Function createFieldGetter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var createFieldGetter = function (definition) {
          switch (definition.type) {
              case 'UINT':
                  if (definition.bitLength % 8 === 0) {
                      return function () {
      Severity: Minor
      Found in lib/frame.js - About 1 hr to fix

        Function createCompleter has 26 lines of code (exceeds 25 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

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

          module.exports.getCompletions = function (line) {
              var args = line.split(' ', 2);
              if (args.length === 1) {
                  var hits = Object.keys(cmdTable).filter(function(c) { return c.indexOf(args[0]) === 0; });
                  if (hits.length === 0) {
          Severity: Minor
          Found in lib/command.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 exec has a Cognitive Complexity of 9 (exceeds 5 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 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 (paramStr) {
                                      params.push('  ' + paramStr + ': ' + param.value);
                                  } else {
                                      params.push('  ' + param.id + ': ' + param.value);
                                  }
          Severity: Major
          Found in lib/util.js - About 45 mins to fix

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

            var createFieldSetter = function (definition) {
                switch (definition.type) {
                    case 'UINT':
                        if (definition.bitLength % 8 === 0) {
                            return function (value) {
            Severity: Minor
            Found in lib/frame.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

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

                'exec': function (args, callback) {
                    if (this.client) {
                        this.client.close(function () {
                            console.log('Connection closed.');
                            if (callback) {
            Severity: Minor
            Found in lib/cmd/close.js - About 35 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 too many return statements within this function.
            Open

                        return cmdTable[args[0]].getCompletions(line);
            Severity: Major
            Found in lib/command.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return [[], line];
              Severity: Major
              Found in lib/command.js - About 30 mins to fix

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

                    'exec': function (args, callback) {
                        var frame;
                        switch (args[1]) {
                            case 'preface':
                                this.client.send(h2.HTTP2_PREFACE, callback);
                Severity: Minor
                Found in lib/cmd/send.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

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

                H2.prototype.send = function (frame, streamId, callback) {
                    if (!this.connection) {
                        console.error('Not connected yet.');
                        arguments[arguments.length - 1]();
                        return;
                Severity: Minor
                Found in lib/h2.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

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

                    "send": (s, resolve, reject) => {
                        try {
                            if (s.type === "preface") {
                                process.stdout.write("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n", 'ascii');
                            } else if (s.type === "raw") {
                Severity: Minor
                Found in h2seq.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

                Function Connection has a Cognitive Complexity of 6 (exceeds 5 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: Minor
                Found in lib/connection.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

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

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

                Severity
                Category
                Status
                Source
                Language