noodlefrenzy/node-amqp10

View on GitHub

Showing 189 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          case 'c':
            len = new Buffer(hexstr.substr(0, 2), 'hex').readUInt8(0);
            consumed += 2;
            hexstr = hexstr.substr(2);
            nent = new Buffer(hexstr.substr(0, 2), 'hex').readUInt8(0);
    Severity: Major
    Found in tools/formatDebugLog.js and 1 other location - About 1 day to fix
    tools/formatDebugLog.js on lines 111..123

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 230.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          case 'd':
            len = new Buffer(hexstr.substr(0, 8), 'hex').readUInt32BE(0);
            consumed += 8;
            hexstr = hexstr.substr(8);
            nent = new Buffer(hexstr.substr(0, 8), 'hex').readUInt32BE(0);
    Severity: Major
    Found in tools/formatDebugLog.js and 1 other location - About 1 day to fix
    tools/formatDebugLog.js on lines 98..110

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 230.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          case 'b':
            len = new Buffer(hexstr.substr(0, 8), 'hex').readUInt32BE(0);
            consumed += 8;
            hexstr = hexstr.substr(8);
            val = hexstr.substr(0, len * 2);
    Severity: Major
    Found in tools/formatDebugLog.js and 1 other location - About 1 day to fix
    tools/formatDebugLog.js on lines 78..87

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 201.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          case 'a':
            len = new Buffer(hexstr.substr(0, 2), 'hex').readUInt8(0);
            consumed += 2;
            hexstr = hexstr.substr(2);
            val = hexstr.substr(0, len * 2);
    Severity: Major
    Found in tools/formatDebugLog.js and 1 other location - About 1 day to fix
    tools/formatDebugLog.js on lines 88..97

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 201.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        if (width === 1 || (width !== 4 && tempBuffer.length < 0xFF)) {
          // map8
          if (!width) bufb.appendUInt8(0xC1);
          bufb.appendUInt8(tempBuffer.length + 1);
          bufb.appendUInt8(keys.length * 2);
    Severity: Major
    Found in lib/types.js and 1 other location - About 5 hrs to fix
    lib/types.js on lines 297..307

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 151.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      if (width === 1 || (width !== 4 && tempBuffer.length < 0xFF)) {
        // map8
        if (!width) bufb.appendUInt8(0xC1);
        bufb.appendUInt8(tempBuffer.length + 1);
        bufb.appendUInt8(keys.length * 2);
    Severity: Major
    Found in lib/types.js and 1 other location - About 5 hrs to fix
    lib/types.js on lines 341..351

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 151.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        defineSection({ code: 0x75, name: 'amqp:data:binary' }, {
          encode: null,
          decode: function(message, described) {
            if (!message.hasOwnProperty('body')) message.body = [];
            else if (!Array.isArray(message.body) || !message.body.every(isData)) {
        Severity: Major
        Found in lib/types/message.js and 1 other location - About 4 hrs to fix
        lib/types/message.js on lines 74..84

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 133.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        defineSection({ code: 0x76, name: 'amqp:amqp-sequence:list' }, {
          encode: null,
          decode: function(message, described) {
            if (!message.hasOwnProperty('body')) message.body = [];
            else if (!Array.isArray(message.body) || !message.body.every(isSequence)) {
        Severity: Major
        Found in lib/types/message.js and 1 other location - About 4 hrs to fix
        lib/types/message.js on lines 61..71

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 133.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

              return this._getSession(session).then(function (session) {
                return new Promise(function(resolve, reject) {
                  var attach = function() {
                    var attachPromise = function(_err, _link) {
                      if (!!_err) return reject(_err);
            Severity: Major
            Found in lib/amqp_client.js and 1 other location - About 4 hrs to fix
            lib/amqp_client.js on lines 384..398

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 123.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

              return this._getSession(session).then(function (session) {
                return new Promise(function(resolve, reject) {
                  var attach = function() {
                    var attachPromise = function(_err, _link) {
                      if (!!_err) return reject(_err);
            Severity: Major
            Found in lib/amqp_client.js and 1 other location - About 4 hrs to fix
            lib/amqp_client.js on lines 308..322

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 123.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            registerType('map', {
              encoder: mapBuilder,
              encodings: [
                encoding(0xc1, {
                  encoder: function(val, bufb, codec) { mapBuilder(val, bufb, codec, 1); },
            Severity: Major
            Found in lib/types.js and 1 other location - About 4 hrs to fix
            lib/types.js on lines 737..749

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                receiver.on('message', function (message) {
                  console.log('received: ', message.body);
                  if (message.annotations) console.log('annotations: ', message.annotations);
                  if (message.body.DataValue === msgVal) {
                    client.disconnect().then(function () {
            Severity: Major
            Found in examples/simple_servicebus_queues.js and 1 other location - About 4 hrs to fix
            examples/simple_activemq_test.js on lines 19..28

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            registerType('array', {
              encoder: arrayBuilder,
              encodings: [
                encoding(0xe0, {
                  encoder: function(val, bufb, codec) { arrayBuilder(val, bufb, codec, 1); },
            Severity: Major
            Found in lib/types.js and 1 other location - About 4 hrs to fix
            lib/types.js on lines 723..735

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                receiver.on('message', function(message) {
                  console.log('received: ', message.body);
                  if (message.annotations) console.log('annotations: ', message.annotations);
                  if (message.body.dataValue === msgId) {
                    client.disconnect().then(function() {
            Severity: Major
            Found in examples/simple_activemq_test.js and 1 other location - About 4 hrs to fix
            examples/simple_servicebus_queues.js on lines 61..70

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

            Severity
            Category
            Status
            Source
            Language