noodlefrenzy/node-amqp10

View on GitHub

Showing 105 of 189 total issues

File types.js has 576 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
var Builder = require('buffer-builder'),
    Int64 = require('node-int64'),
    errors = require('./errors'),
    AMQPArray = require('./types/amqp_composites').Array,
Severity: Major
Found in lib/types.js - About 1 day to fix

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

    function Connection(connectPolicy) {
      Connection.super_.call(this);
    
      var options = connectPolicy.options;
      u.assertArguments(options, ['containerId', 'hostname']);
    Severity: Major
    Found in lib/connection.js - About 5 hrs to fix

      File session.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      var EventEmitter = require('events').EventEmitter,
          util = require('util'),
      
      
      Severity: Minor
      Found in lib/session.js - About 5 hrs to fix

        File connection.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        var EventEmitter = require('events').EventEmitter,
            fs = require('fs'),
            util = require('util'),
        
        
        Severity: Minor
        Found in lib/connection.js - About 4 hrs to fix

          File amqp_client.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          var EventEmitter = require('events').EventEmitter,
              Promise = require('bluebird'),
              debug = require('debug')('amqp10:client'),
              util = require('util'),
          Severity: Minor
          Found in lib/amqp_client.js - About 4 hrs to fix

            Function wrapField has a Cognitive Complexity of 28 (exceeds 5 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 4 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 connect has 100 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            AMQPClient.prototype.connect = function(url, policyOverrides) {
              var self = this;
              policyOverrides = policyOverrides || {};
              var connectPolicy = u.deepMerge(policyOverrides, self.policy.connect);
              return new Promise(function(resolve, reject) {
            Severity: Major
            Found in lib/amqp_client.js - About 4 hrs to fix

              Function x has 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function x(hexstr, consumed, result, indent) {
                if (hexstr.length === 0) return { consumed: consumed, result: result };
              
                var prefix = hexstr.substr(0, 2);
                hexstr = hexstr.substr(2);
              Severity: Major
              Found in tools/formatDebugLog.js - About 3 hrs to fix

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

                function deepMerge() {
                  var args = Array.prototype.slice.call(arguments);
                  var helper = function(tgt, src, key) {
                    var s2, t2;
                    if (key === undefined) {
                Severity: Minor
                Found in lib/utilities.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 defineComposite has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                function defineComposite(Base, definition) {
                  if (definition === undefined) {
                    definition = Base;
                    Base = Object;
                  }
                Severity: Minor
                Found in lib/types/composite_type.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 arrayBuilder has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                function arrayBuilder(val, bufb, codec, width) {
                  if (!(val instanceof AMQPArray)) {
                    throw new errors.EncodingError(val, 'Unsure how to encode non-amqp array as array');
                  }
                
                
                Severity: Minor
                Found in lib/types.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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                SenderLink.prototype.send = function(msg, options) {
                  options = options || {};
                
                  var noReply = false;
                  if (options.hasOwnProperty('noReply')) {
                Severity: Minor
                Found in lib/sender_link.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 mapBuilderForKeyType has a Cognitive Complexity of 22 (exceeds 5 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 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

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

                'use strict';
                var Builder = require('buffer-builder'),
                    DescribedType = require('./types/described_type'),
                    errors = require('./errors'),
                    codec = require('./codec'),
                Severity: Minor
                Found in lib/frames.js - About 3 hrs to fix

                  Function send has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  SenderLink.prototype.send = function(msg, options) {
                    options = options || {};
                  
                    var noReply = false;
                    if (options.hasOwnProperty('noReply')) {
                  Severity: Major
                  Found in lib/sender_link.js - About 2 hrs to fix

                    Function Policy has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function Policy(overrides) {
                      if (!(this instanceof Policy))
                        return new Policy(overrides);
                    
                      u.defaults(this, overrides, {
                    Severity: Major
                    Found in lib/policies/policy.js - About 2 hrs to fix

                      Function _encodeObject has a Cognitive Complexity of 20 (exceeds 5 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 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 encodeMessage has a Cognitive Complexity of 19 (exceeds 5 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 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 _receiveAny has a Cognitive Complexity of 19 (exceeds 5 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 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 x has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function x(hexstr, consumed, result, indent) {
                        if (hexstr.length === 0) return { consumed: consumed, result: result };
                      
                        var prefix = hexstr.substr(0, 2);
                        hexstr = hexstr.substr(2);
                      Severity: Minor
                      Found in tools/formatDebugLog.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

                      Severity
                      Category
                      Status
                      Source
                      Language