noodlefrenzy/node-amqp10

View on GitHub

Showing 105 of 189 total issues

Function mapBuilderForKeyType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mapBuilderForKeyType(keyType) {
  return function mapBuilder(map, bufb, codec, width) {
    if (typeof map !== 'object') {
      throw new errors.EncodingError(map, 'Unsure how to encode non-object as map');
    }
Severity: Minor
Found in lib/types.js - About 1 hr to fix

    Function createSender has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    AMQPClient.prototype.createSender = function(address, policyOverrides, session) {
      if (!this._connection) {
        throw new Error('Must connect before creating links');
      }
    
    
    Severity: Minor
    Found in lib/amqp_client.js - About 1 hr to fix

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

      Policy.prototype.parseAddress = function(address) {
        var parsedAddress = url.parse(address);
        var result = {
          host: parsedAddress.hostname || parsedAddress.href,
          path: (parsedAddress.path && parsedAddress.path !== address) ?
      Severity: Minor
      Found in lib/policies/policy.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 encoder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            encoder: function(val, bufb) {
              if (val instanceof Int64) return bufb.appendBuffer(val.toBuffer(true));
              if (val instanceof Buffer) return bufb.appendBuffer(val);
              if (typeof val !== 'number' || !(val instanceof Number)) val = Number(val);
              if (!Number.isFinite(val)) {
      Severity: Minor
      Found in lib/types.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 encoder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        encoder: function(val, bufb) {
          var code = 0x80;
          if (val instanceof Int64 || val > 0xFF) {
            var check = (val instanceof Int64) ? val.toNumber(true) : val;
            if (check === 0) {
      Severity: Minor
      Found in lib/types.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 encodeMessage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.encodeMessage = function(message, buffer) {
        var _keys = Object.keys(sectionByProperty), _len = _keys.length;
        for (var i = 0; i < _len; ++i) {
          var property = _keys[i], definition = sectionByProperty[property];
          if (message.hasOwnProperty(property)) {
      Severity: Minor
      Found in lib/types/message.js - About 1 hr to fix

        Function mapBuilder has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          return function mapBuilder(map, bufb, codec, width) {
            if (typeof map !== 'object') {
              throw new errors.EncodingError(map, 'Unsure how to encode non-object as map');
            }
        
        
        Severity: Minor
        Found in lib/types.js - About 1 hr to fix

          Function _messageReceived has 31 lines of code (exceeds 25 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 1 hr to fix

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

            function mapBuilder(map, bufb, codec, width) {
              if (typeof map !== 'object') {
                throw new errors.EncodingError(map, 'Unsure how to encode non-object as map');
              }
            
            
            Severity: Minor
            Found in lib/types.js - About 1 hr to fix

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

              frames.writeFrame = function(frame, stream, options, callback) {
                if (!(frame instanceof frames.Frame)) {
                  throw new errors.EncodingError(frame, 'unknown frame type');
                }
              
              
              Severity: Minor
              Found in lib/frames.js - About 1 hr to fix

                Function _encodeObject has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Codec.prototype._encodeObject = function(value, buffer) {
                  if (value instanceof DescribedType) {
                    buffer.appendUInt8(0x00);
                
                    // NOTE: Described type constructors are either ulongs or a symbol. Here
                Severity: Minor
                Found in lib/codec.js - About 1 hr to fix

                  Function parseAddress has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Policy.prototype.parseAddress = function(address) {
                    var parsedAddress = url.parse(address);
                    var result = {
                      host: parsedAddress.hostname || parsedAddress.href,
                      path: (parsedAddress.path && parsedAddress.path !== address) ?
                  Severity: Minor
                  Found in lib/policies/policy.js - About 1 hr to fix

                    Function wrapField has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function wrapField(field, value) {
                      if (value instanceof ForcedType) return value;
                      if (value === undefined || value === null) {
                        if (field.mandatory) throw new Error('missing mandatory field: ' + field.name);
                        if (field.hasOwnProperty('default')) return wrapField(field, field.default);
                    Severity: Minor
                    Found in lib/types/composite_type.js - About 1 hr to fix

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

                      Session.prototype._processFrame = function(frame) {
                        if (frame instanceof frames.BeginFrame && (frame.remoteChannel === this.channel)) {
                          this.sm.beginReceived();
                          this._beginReceived(frame);
                          return;
                      Severity: Minor
                      Found in lib/session.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 Connection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function Connection(connectPolicy) {
                        Connection.super_.call(this);
                      
                        var options = connectPolicy.options;
                        u.assertArguments(options, ['containerId', 'hostname']);
                      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 _tryReceiveHeader has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Connection.prototype._tryReceiveHeader = function(header) {
                        header = header || constants.amqpVersion;
                        if (this._buffer.length >= header.length) {
                          var serverVersion = this._buffer.slice(0, 8);
                          this._buffer.consume(8);
                      Severity: Minor
                      Found in lib/connection.js - About 1 hr to fix

                        Function stateMachine has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var stateMachine = function(link) {
                          var detachHandler = function(frame) {
                            if (this.getMachineState() === 'ATTACHED') {
                              this.ATTACHED.sendDetach({ closed: frame.closed });
                            }
                        Severity: Minor
                        Found in lib/link.js - About 1 hr to fix

                          Function parseHex has 26 lines of code (exceeds 25 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 1 hr to fix

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

                            Session.prototype.createLink = function(linkPolicy) {
                              var policy = u.deepCopy(linkPolicy),
                                  attachOptions = policy.attach || {};
                            
                              attachOptions.handle = this._nextHandle();
                            Severity: Minor
                            Found in lib/session.js - About 1 hr to fix

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

                              AMQPClient.prototype._getSession = function(session) {
                                // Just return the provided session if one was passed in
                                if (session) {
                                  return Promise.resolve(session);
                                }
                              Severity: Minor
                              Found in lib/amqp_client.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language