noodlefrenzy/node-amqp10

View on GitHub

Showing 105 of 189 total issues

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

Connection.prototype._receiveAny = function() {
  var frame = null;
  while (true) {
    if (this.sasl && !this.sasl.receivedHeader) {
      if (!this._tryReceiveHeader(constants.saslVersion)) break;
Severity: Minor
Found in lib/connection.js - About 1 hr to fix

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

    function parseHex(hexstr) {
      var amqpstr = constants.amqpVersion.toString('hex');
      var headerIdx = hexstr.indexOf(amqpstr);
      var body = hexstr;
      if (headerIdx === -1) {
    Severity: Minor
    Found in tools/formatDebugLog.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 _processOpenFrame has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    Connection.prototype._processOpenFrame = function(frame) {
      this.connSM.openReceived();
      if (this.connSM.getMachineState() === 'OPEN_RCVD') {
        this.connSM.sendOpen();
      }
    Severity: Minor
    Found in lib/connection.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 _messageReceived has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    ReceiverLink.prototype._messageReceived = function(transferFrame) {
      if (transferFrame.aborted) {
        this._currentTransferFrame = null;
        debug('Message transfer aborted.');
        return;
    Severity: Minor
    Found in lib/receiver_link.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 _dispositionReceived has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    SenderLink.prototype._dispositionReceived = function(details) {
      if (!details.settled) {
        return;
      }
    
    
    Severity: Minor
    Found in lib/sender_link.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 encode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    Codec.prototype.encode = function(value, buffer, forceType) {
      // Special-case null values
      if (value === null) {
        return types.null.encode(value, buffer);
      }
    Severity: Minor
    Found in lib/codec.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 RefreshSettled has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      RefreshSettled: function (threshold) {
        return function (link, options) {
          if (link.policy.rcvSettleMode === constants.receiverSettleMode.autoSettle) {
            throw new errors.InvalidStateError('Cannot specify RefreshSettled as link refresh policy when auto-settling messages.');
          }
    Severity: Minor
    Found in lib/policies/policy_utilities.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 bufferEqualsLegacy has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function bufferEqualsLegacy(lhs, rhs, offset1, offset2, size) {
    Severity: Minor
    Found in lib/utilities.js - About 35 mins to fix

      Function _readOrPeekFixed has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      Codec.prototype._readOrPeekFixed = function(buf, offset, remaining, doNotConsume, numBytes) {
      Severity: Minor
      Found in lib/codec.js - About 35 mins to fix

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

        var verifyImplementation = function (transportFactory) {
          // NOTE: if we only cared about internal modules, 'instanceof' would work, but
          // since we're "duck typing" transports to avoid circular dependencies, we have to
          // verify the transport prototype differently.
        
        
        Severity: Minor
        Found in lib/transport/index.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

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

        SenderLink.prototype._dispatchPendingSends = function(err) {
          if (this._pendingSends && this._pendingSends.length !== 0) {
            while (this._pendingSends.length > 0 && (!!err ? true : this.canSend())) {
              var sendMessage = this._pendingSends.shift();
              sendMessage(err);
        Severity: Minor
        Found in lib/sender_link.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

          else if (frame instanceof frames.DispositionFrame) return this._processDispositionFrame(frame);
        Severity: Major
        Found in lib/session.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return new ForcedType(field.type, value);
          Severity: Major
          Found in lib/types/composite_type.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              if (value instanceof ForcedType) return this.encode(value.value, buffer, value.typeName);
            Severity: Major
            Found in lib/codec.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                else if (frame instanceof frames.FlowFrame) return this._processFlowFrame(frame);
              Severity: Major
              Found in lib/session.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      if (remaining < 5) return false;
                Severity: Major
                Found in lib/codec.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    if (field.type === '*') return value;
                  Severity: Major
                  Found in lib/types/composite_type.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return new field.requires(value);
                    Severity: Major
                    Found in lib/types/composite_type.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        if (value.toDescribedType && typeof value.toDescribedType === 'function') return value;
                      Severity: Major
                      Found in lib/types/composite_type.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            if (value.length === 0) return new ForcedType(field.type, null);
                        Severity: Major
                        Found in lib/types/composite_type.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language