danielwippermann/resol-vbus

View on GitHub
src/connection.js

Summary

Maintainability
F
1 wk
Test Coverage

Function receive has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
Open

    receive(timestamp, chunk) {
        const _this = this;

        if (this.listenerCount('rawData') > 0) {
            this.emit('rawData', chunk, timestamp);
Severity: Minor
Found in src/connection.js - About 2 days 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 connection.js has 622 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! resol-vbus | Copyright (c) 2013-present, Daniel Wippermann | MIT license */

const { Duplex } = require('stream');


Severity: Major
Found in src/connection.js - About 1 day to fix

    Function receive has 123 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        receive(timestamp, chunk) {
            const _this = this;
    
            if (this.listenerCount('rawData') > 0) {
                this.emit('rawData', chunk, timestamp);
    Severity: Major
    Found in src/connection.js - About 4 hrs to fix

      Function transceive has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          async transceive(txData, options) {
              options = applyDefaultOptions({}, options, {
                  timeout: 500,
                  timeoutIncr: 0,
                  tries: 1,
      Severity: Major
      Found in src/connection.js - About 3 hrs to fix

        Connection has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Connection extends Duplex {
        
            /**
             * Creates a new Connection instance and optionally initializes its member with the given values.
             *
        Severity: Minor
        Found in src/connection.js - About 2 hrs to fix

          Function transceive has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              async transceive(txData, options) {
                  options = applyDefaultOptions({}, options, {
                      timeout: 500,
                      timeoutIncr: 0,
                      tries: 1,
          Severity: Minor
          Found in src/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 getValueById has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              getValueById(address, valueId, options) {
                  const _this = this;
          
                  options = applyDefaultOptions({}, options, {
                      timeout: 500,
          Severity: Minor
          Found in src/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 getValueById has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getValueById(address, valueId, options) {
                  const _this = this;
          
                  options = applyDefaultOptions({}, options, {
                      timeout: 500,
          Severity: Minor
          Found in src/connection.js - About 1 hr to fix

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

                setValueById(address, valueId, value, options) {
                    const _this = this;
            
                    options = applyDefaultOptions({}, options, {
                        timeout: 500,
            Severity: Minor
            Found in src/connection.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                      while (valid && (frameIndex < start + length)) {
                                          if (!Header.calcAndCompareChecksum(version, buffer, frameIndex, frameIndex + 5)) {
                                              // console.log('checksum error in frame index ' + frameIndex);
                                              valid = false;
                                          }
              Severity: Major
              Found in src/connection.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (!Header.calcAndCompareChecksum(version, buffer, start + 1, start + 9)) {
                                            // console.log('checksum error in header');
                                            valid = false;
                                        }
                Severity: Major
                Found in src/connection.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      } else if (version === 0x20) {
                                          if (!Header.calcAndCompareChecksum(version, buffer, start + 1, start + 15)) {
                                              valid = false;
                                          }
                                      } else if (version === 0x30) {
                  Severity: Major
                  Found in src/connection.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if (index >= start + 6) {
                                            length = 8 + Telegram.getFrameCountForCommand(buffer [start + 6]) * 9;
                                        } else {
                                            length = 8;
                                        }
                    Severity: Major
                    Found in src/connection.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (majorVersion === 1) {
                                                  if (this.listenerCount('packet') > 0) {
                                                      const packet = Packet.fromLiveBuffer(buffer, start, index);
                                                      packet.timestamp = new Date(timestamp);
                                                      packet.channel = this.channel;
                      Severity: Major
                      Found in src/connection.js - About 45 mins to fix

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

                            setValueById(address, valueId, value, options) {
                                const _this = this;
                        
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                        Severity: Minor
                        Found in src/connection.js - About 35 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                            getValueIdByIdHash(address, valueIdHash, options) {
                                const _this = this;
                        
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                        Severity: Minor
                        Found in src/connection.js - About 35 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                            ping(address, valueId, value, options) {
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                                    timeoutIncr: 500,
                                    tries: 3,
                        Severity: Minor
                        Found in src/connection.js - About 35 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function setBulkValueById has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            setBulkValueById(address, valueId, value, options) {
                                const _this = this;
                        
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                        Severity: Minor
                        Found in src/connection.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function getValueIdHashById has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            getValueIdHashById(address, valueId, options) {
                                const _this = this;
                        
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                        Severity: Minor
                        Found in src/connection.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                            getCaps1(address, options) {
                                const _this = this;
                        
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 1 day to fix
                        src/connection.js on lines 762..792
                        src/connection.js on lines 805..835

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

                        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 3 locations. Consider refactoring.
                        Open

                            rollbackBulkValueTransaction(address, options) {
                                const _this = this;
                        
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 1 day to fix
                        src/connection.js on lines 675..705
                        src/connection.js on lines 762..792

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

                        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 3 locations. Consider refactoring.
                        Open

                            commitBulkValueTransaction(address, options) {
                                const _this = this;
                        
                                options = applyDefaultOptions({}, options, {
                                    timeout: 500,
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 1 day to fix
                        src/connection.js on lines 675..705
                        src/connection.js on lines 805..835

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

                        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

                                options.filterDatagram = function(rxDatagram, done) {
                                    if (rxDatagram.destinationAddress !== _this.selfAddress) {
                                        // nop
                                    } else if (rxDatagram.sourceAddress !== address) {
                                        // nop
                        Severity: Major
                        Found in src/connection.js and 1 other location - About 3 hrs to fix
                        src/connection.js on lines 870..882

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

                        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

                                options.filterDatagram = function(rxDatagram, done) {
                                    if (rxDatagram.destinationAddress !== _this.selfAddress) {
                                        // nop
                                    } else if (rxDatagram.sourceAddress !== address) {
                                        // nop
                        Severity: Major
                        Found in src/connection.js and 1 other location - About 3 hrs to fix
                        src/connection.js on lines 555..567

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

                        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 3 locations. Consider refactoring.
                        Open

                                                } else if (majorVersion === 3) {
                                                    if (this.listenerCount('telegram') > 0) {
                                                        const telegram = Telegram.fromLiveBuffer(buffer, start, index);
                                                        telegram.timestamp = new Date(timestamp);
                                                        telegram.channel = this.channel;
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 2 hrs to fix
                        src/connection.js on lines 216..237
                        src/connection.js on lines 223..237

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

                        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 3 locations. Consider refactoring.
                        Open

                                                if (majorVersion === 1) {
                                                    if (this.listenerCount('packet') > 0) {
                                                        const packet = Packet.fromLiveBuffer(buffer, start, index);
                                                        packet.timestamp = new Date(timestamp);
                                                        packet.channel = this.channel;
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 2 hrs to fix
                        src/connection.js on lines 223..237
                        src/connection.js on lines 230..237

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

                        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 3 locations. Consider refactoring.
                        Open

                                                } else if (majorVersion === 2) {
                                                    if (this.listenerCount('datagram') > 0) {
                                                        const datagram = Datagram.fromLiveBuffer(buffer, start, index);
                                                        datagram.timestamp = new Date(timestamp);
                                                        datagram.channel = this.channel;
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 2 hrs to fix
                        src/connection.js on lines 216..237
                        src/connection.js on lines 230..237

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

                        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 3 locations. Consider refactoring.
                        Open

                                    if (options.filterTelegram) {
                                        onTelegram = function(rxTelegram) {
                                            const result = options.filterTelegram(rxTelegram, done);
                        
                                            promiseToCallback(result, done);
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 1 hr to fix
                        src/connection.js on lines 324..332
                        src/connection.js on lines 334..342

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

                        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 3 locations. Consider refactoring.
                        Open

                                    if (options.filterPacket) {
                                        onPacket = function(rxPacket) {
                                            const result = options.filterPacket(rxPacket, done);
                        
                                            promiseToCallback(result, done);
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 1 hr to fix
                        src/connection.js on lines 334..342
                        src/connection.js on lines 344..352

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

                        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 3 locations. Consider refactoring.
                        Open

                                    if (options.filterDatagram) {
                                        onDatagram = function(rxDatagram) {
                                            const result = options.filterDatagram(rxDatagram, done);
                        
                                            promiseToCallback(result, done);
                        Severity: Major
                        Found in src/connection.js and 2 other locations - About 1 hr to fix
                        src/connection.js on lines 324..332
                        src/connection.js on lines 344..352

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

                        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

                                const txDatagram = new Datagram({
                                    destinationAddress: address,
                                    sourceAddress: this.selfAddress,
                                    command: 0x1100,
                                    valueId: 0,
                        Severity: Minor
                        Found in src/connection.js and 1 other location - About 40 mins to fix
                        src/connection.js on lines 728..734

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

                        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

                                const txDatagram = new Datagram({
                                    destinationAddress: address,
                                    sourceAddress: this.selfAddress,
                                    command: 0x1400,
                                    valueId: 0,
                        Severity: Minor
                        Found in src/connection.js and 1 other location - About 40 mins to fix
                        src/connection.js on lines 639..645

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

                        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