noodlefrenzy/node-amqp10

View on GitHub
lib/types.js

Summary

Maintainability
F
1 wk
Test Coverage

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

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

      Function mapBuilder has a Cognitive Complexity of 12 (exceeds 5 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

      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 listBuilder has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      function listBuilder(list, bufb, codec, width) {
        if (!Array.isArray(list)) {
          throw new errors.EncodingError(list, 'Unsure how to encode non-array as list');
        }
      
      
      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 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 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 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 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 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

            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

            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

            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

            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

                encoding(0xb3, {
                  encoder: function(val, bufb) {
                    var encoded = (val instanceof Buffer) ? val : new Buffer(val, 'ascii');
                    bufb.appendUInt32BE(encoded.length);
                    bufb.appendBuffer(encoded);
            Severity: Major
            Found in lib/types.js and 1 other location - About 3 hrs to fix
            lib/types.js on lines 686..693

            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 97.

            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

                encoding(0xa3, {
                  encoder: function(val, bufb) {
                    var encoded = (val instanceof Buffer) ? val : new Buffer(val, 'ascii');
                    bufb.appendUInt8(encoded.length);
                    bufb.appendBuffer(encoded);
            Severity: Major
            Found in lib/types.js and 1 other location - About 3 hrs to fix
            lib/types.js on lines 694..701

            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 97.

            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 && arrayBytes.length < 0xFF && val.array.length < 0xFF)) {
                if (!width) bufb.appendUInt8(0xE0);
                length = arrayBytes.length + 1;
                if (typeof val.elementType === 'number') length += 1;
                bufb.appendUInt8(length); // buffer + count + constructor
            Severity: Major
            Found in lib/types.js and 1 other location - About 2 hrs to fix
            lib/types.js on lines 213..219

            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 90.

            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

              } else {
                if (!width) bufb.appendUInt8(0xF0);
                length = arrayBytes.length + 4;
                if (typeof val.elementType === 'number') length += 1;
                bufb.appendUInt32BE(length); // buffer + count + constructor
            Severity: Major
            Found in lib/types.js and 1 other location - About 2 hrs to fix
            lib/types.js on lines 207..213

            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 90.

            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

                encoding(0xa0, {
                  encoder: function(val, bufb) {
                    bufb.appendUInt8(val.length);
                    bufb.appendBuffer(val);
                  },
            Severity: Major
            Found in lib/types.js and 1 other location - About 1 hr to fix
            lib/types.js on lines 633..639

            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 67.

            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

                encoding(0xb0, {
                  encoder: function(val, bufb) {
                    bufb.appendUInt32BE(val.length);
                    bufb.appendBuffer(val);
                  },
            Severity: Major
            Found in lib/types.js and 1 other location - About 1 hr to fix
            lib/types.js on lines 626..632

            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 67.

            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

                if (!width && keys.length === 0) {
                  bufb.appendUInt8(0xC1);
                  bufb.appendUInt8(1);
                  bufb.appendUInt8(0);
                  return;
            Severity: Major
            Found in lib/types.js and 1 other location - About 1 hr to fix
            lib/types.js on lines 280..285

            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 57.

            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

              if (!width && keys.length === 0) {
                bufb.appendUInt8(0xC1);
                bufb.appendUInt8(1);
                bufb.appendUInt8(0);
                return;
            Severity: Major
            Found in lib/types.js and 1 other location - About 1 hr to fix
            lib/types.js on lines 323..328

            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 57.

            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

              } else {
                // list32
                if (!width) bufb.appendUInt8(0xD0);
                bufb.appendUInt32BE(tempBuffer.length + 4);
                bufb.appendUInt32BE(list.length);
            Severity: Major
            Found in lib/types.js and 1 other location - About 1 hr to fix
            lib/types.js on lines 116..121

            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 56.

            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 || (tempBuffer.length < 0xFF && list.length < 0xFF && width !== 4)) {
                // list8
                if (!width) bufb.appendUInt8(0xC0);
                bufb.appendUInt8(tempBuffer.length + 1);
                bufb.appendUInt8(list.length);
            Severity: Major
            Found in lib/types.js and 1 other location - About 1 hr to fix
            lib/types.js on lines 121..126

            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 56.

            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

                  encoder: function(val, bufb) {
                    var encoded = new Buffer(val, 'utf8');
                    bufb.appendUInt8(encoded.length);
                    bufb.appendBuffer(encoded);
                  },
            Severity: Minor
            Found in lib/types.js and 1 other location - About 45 mins to fix
            lib/types.js on lines 664..668

            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 50.

            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

                  encoder: function(val, bufb) {
                    var encoded = new Buffer(val, 'utf8');
                    bufb.appendUInt32BE(encoded.length);
                    bufb.appendBuffer(encoded);
                  },
            Severity: Minor
            Found in lib/types.js and 1 other location - About 45 mins to fix
            lib/types.js on lines 653..657

            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 50.

            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

            There are no issues that match your filters.

            Category
            Status