danielwippermann/resol-vbus

View on GitHub
src/specification.js

Summary

Maintainability
F
2 wks
Test Coverage

File specification.js has 1215 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

const crypto = require('crypto');


Severity: Major
Found in src/specification.js - About 3 days to fix

    Function convertRawValue has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        convertRawValue(rawValue_, sourceUnit_, targetUnit_) {
            const that = this;
    
            let conversions;
            if (Array.isArray(sourceUnit_)) {
    Severity: Minor
    Found in src/specification.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

    Specification has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Specification {
    
        /**
         * Creates a new Specification instance and optionally initializes its members with the given values.
         *
    Severity: Minor
    Found in src/specification.js - About 4 hrs to fix

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

          getPacketFieldsForHeaders(headers) {
              const _this = this;
      
              // filter out all packets
              const packets = headers.reduce((memo, header) => {
      Severity: Minor
      Found in src/specification.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 getDeviceSpecification has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          getDeviceSpecification(selfAddress, peerAddress, channel) {
              if (typeof selfAddress === 'object') {
                  if (peerAddress === 'source') {
                      ({ channel } = selfAddress);
                      peerAddress = selfAddress.destinationAddress;
      Severity: Minor
      Found in src/specification.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 _convertEnergyRawValue has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _convertEnergyRawValue(rawValue, sourceUnitCode, targetUnitCode) {
              switch (sourceUnitCode) {
              case 'WattHours':
                  // nop
                  break;
      Severity: Major
      Found in src/specification.js - About 3 hrs to fix

        Function getPacketFieldsForHeaders has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getPacketFieldsForHeaders(headers) {
                const _this = this;
        
                // filter out all packets
                const packets = headers.reduce((memo, header) => {
        Severity: Major
        Found in src/specification.js - About 2 hrs to fix

          Function _createUInt32BlockTypeFieldSpecification has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _createUInt32BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                  return {
                      fieldId: sprintf('%s_%03d_4_0', fieldIdPrefix, offset),
                      name,
                      type: this.getTypeById(typeId),
          Severity: Major
          Found in src/specification.js - About 2 hrs to fix

            Function convertRawValue has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                convertRawValue(rawValue_, sourceUnit_, targetUnit_) {
                    const that = this;
            
                    let conversions;
                    if (Array.isArray(sourceUnit_)) {
            Severity: Major
            Found in src/specification.js - About 2 hrs to fix

              Function _createUInt32BlockTypeFieldSpecification has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  _createUInt32BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                      return {
                          fieldId: sprintf('%s_%03d_4_0', fieldIdPrefix, offset),
                          name,
                          type: this.getTypeById(typeId),
              Severity: Minor
              Found in src/specification.js - About 2 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function formatTextValueFromRawValueInternal has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  formatTextValueFromRawValueInternal(rawValue, unit, rootType, precision, defaultUnit) {
                      const unitText = unit ? unit.unitText : defaultUnit ? defaultUnit.unitText : '';
              
                      let result, textValue, format;
                      if ((rawValue === undefined) || (rawValue === null)) {
              Severity: Minor
              Found in src/specification.js - About 2 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function formatTextValueFromRawValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  formatTextValueFromRawValue(packetField, rawValue, unit) {
                      let textValue;
              
                      if ((rawValue !== undefined) && (rawValue !== null)) {
                          if (typeof unit === 'string') {
              Severity: Minor
              Found in src/specification.js - About 2 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function storeSpecificationData has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static storeSpecificationData(options) {
                      if (options === undefined) {
                          options = {};
                      }
                      if (options instanceof Specification) {
              Severity: Major
              Found in src/specification.js - About 2 hrs to fix

                Function getBlockTypeSectionsForHeaders has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getBlockTypeSectionsForHeaders(headers) {
                        const _this = this;
                
                        return headers.reduce((memo, header) => {
                            if (((header.getProtocolVersion() & 0xF0) === 0x10) && (header.destinationAddress === 0x0015) && (header.command === 0x0100)) {
                Severity: Major
                Found in src/specification.js - About 2 hrs to fix

                  Function getBlockTypePacketSpecificationsForSections has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      getBlockTypePacketSpecificationsForSections(sections) {
                          const _this = this;
                  
                          return sections.reduce((memo, section) => {
                              const { sectionId } = section;
                  Severity: Major
                  Found in src/specification.js - About 2 hrs to fix

                    Function getDeviceSpecification has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        getDeviceSpecification(selfAddress, peerAddress, channel) {
                            if (typeof selfAddress === 'object') {
                                if (peerAddress === 'source') {
                                    ({ channel } = selfAddress);
                                    peerAddress = selfAddress.destinationAddress;
                    Severity: Major
                    Found in src/specification.js - About 2 hrs to fix

                      Function result has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              const result = conversions.reduce((valueInfo, conversion) => {
                                  let { rawValue } = valueInfo;
                                  const { sourceUnit, targetUnit } = conversion;
                                  const unitFamily = sourceUnit && sourceUnit.unitFamily;
                      
                      
                      Severity: Minor
                      Found in src/specification.js - About 2 hrs to fix

                        Function loadSpecificationData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            static loadSpecificationData(rawSpecificationData, options) {
                                if (rawSpecificationData === undefined) {
                                    rawSpecificationData = {};
                                }
                                if (options === undefined) {
                        Severity: Minor
                        Found in src/specification.js - About 1 hr to fix

                          Function getBlockTypeFieldsForSections has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              getBlockTypeFieldsForSections(sections) {
                                  const _this = this;
                          
                                  const sectionByBlockTypeId = sections.reduce((memo, section) => {
                                      memo [section.sectionId] = section;
                          Severity: Minor
                          Found in src/specification.js - About 1 hr to fix

                            Function getPacketSpecification has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                getPacketSpecification(headerOrChannel, destinationAddress, sourceAddress, command) {
                                    if (typeof headerOrChannel === 'object') {
                                        ({ command, sourceAddress, destinationAddress } = headerOrChannel);
                                        headerOrChannel = headerOrChannel.channel;
                                    } else if (typeof headerOrChannel === 'string') {
                            Severity: Minor
                            Found in src/specification.js - About 1 hr to fix

                              Function _createInt16BlockTypeFieldSpecification has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  _createInt16BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                                      return {
                                          fieldId: sprintf('%s_%03d_2_0', fieldIdPrefix, offset),
                                          name,
                                          type: this.getTypeById(typeId),
                              Severity: Minor
                              Found in src/specification.js - About 1 hr to fix

                                Function getRawValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    getRawValue(packetField, buffer, start, end) {
                                        if (start === undefined) {
                                            start = 0;
                                        }
                                        if (end === undefined) {
                                Severity: Minor
                                Found in src/specification.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 getBlockTypeFieldsForSections has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    getBlockTypeFieldsForSections(sections) {
                                        const _this = this;
                                
                                        const sectionByBlockTypeId = sections.reduce((memo, section) => {
                                            memo [section.sectionId] = section;
                                Severity: Minor
                                Found in src/specification.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 setRawValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    setRawValue(packetField, rawValue, buffer, start, end) {
                                        if (start === undefined) {
                                            start = 0;
                                        }
                                        if (end === undefined) {
                                Severity: Minor
                                Found in src/specification.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 formatTextValueFromRawValueInternal has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    formatTextValueFromRawValueInternal(rawValue, unit, rootType, precision, defaultUnit) {
                                        const unitText = unit ? unit.unitText : defaultUnit ? defaultUnit.unitText : '';
                                
                                        let result, textValue, format;
                                        if ((rawValue === undefined) || (rawValue === null)) {
                                Severity: Minor
                                Found in src/specification.js - About 1 hr to fix

                                  Function getPacketSpecification has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      getPacketSpecification(headerOrChannel, destinationAddress, sourceAddress, command) {
                                          if (typeof headerOrChannel === 'object') {
                                              ({ command, sourceAddress, destinationAddress } = headerOrChannel);
                                              headerOrChannel = headerOrChannel.channel;
                                          } else if (typeof headerOrChannel === 'string') {
                                  Severity: Minor
                                  Found in src/specification.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 storeSpecificationData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      static storeSpecificationData(options) {
                                          if (options === undefined) {
                                              options = {};
                                          }
                                          if (options instanceof Specification) {
                                  Severity: Minor
                                  Found in src/specification.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 _convertVolumeFlowRawValue has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      _convertVolumeFlowRawValue(rawValue, sourceUnitCode, targetUnitCode) {
                                          switch (sourceUnitCode) {
                                          case 'LitersPerHour':
                                              // nop
                                              break;
                                  Severity: Minor
                                  Found in src/specification.js - About 1 hr to fix

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

                                        _createUInt8BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                                            return {
                                                fieldId: sprintf('%s_%03d_1_0', fieldIdPrefix, offset),
                                                name,
                                                type: this.getTypeById(typeId),
                                    Severity: Minor
                                    Found in src/specification.js - About 1 hr to fix

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

                                          _createInt16BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                                              return {
                                                  fieldId: sprintf('%s_%03d_2_0', fieldIdPrefix, offset),
                                                  name,
                                                  type: this.getTypeById(typeId),
                                      Severity: Minor
                                      Found in src/specification.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 _convertTimeRawValue has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          _convertTimeRawValue(rawValue, sourceUnitCode, targetUnitCode) {
                                              switch (sourceUnitCode) {
                                              case 'Seconds':
                                                  // nop
                                                  break;
                                      Severity: Minor
                                      Found in src/specification.js - About 1 hr to fix

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

                                            invertConversions(conversions) {
                                                if (!Array.isArray(conversions)) {
                                                    return conversions;
                                                }
                                        
                                        
                                        Severity: Minor
                                        Found in src/specification.js - About 1 hr to fix

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

                                              formatTextValueFromRawValue(packetField, rawValue, unit) {
                                                  let textValue;
                                          
                                                  if ((rawValue !== undefined) && (rawValue !== null)) {
                                                      if (typeof unit === 'string') {
                                          Severity: Minor
                                          Found in src/specification.js - About 1 hr to fix

                                            Function getPacketFieldSpecification has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                getPacketFieldSpecification(packetSpecOrId, fieldId) {
                                                    let packetFieldSpec;
                                                    if (typeof packetSpecOrId === 'string') {
                                                        if (this.specificationData.filteredPacketFieldSpecs) {
                                                            packetFieldSpec = this.specificationData.filteredPacketFieldSpecs.find(pfs => pfs.filteredPacketFieldId === packetSpecOrId);
                                            Severity: Minor
                                            Found in src/specification.js - About 55 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 setPacketFieldRawValues has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                setPacketFieldRawValues(packetFields, rawValues) {
                                                    const _this = this;
                                            
                                                    const packetFieldById = packetFields.reduce((memo, packetField) => {
                                                        memo [packetField.id] = packetField;
                                            Severity: Minor
                                            Found in src/specification.js - About 45 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 loadSpecificationData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                static loadSpecificationData(rawSpecificationData, options) {
                                                    if (rawSpecificationData === undefined) {
                                                        rawSpecificationData = {};
                                                    }
                                                    if (options === undefined) {
                                            Severity: Minor
                                            Found in src/specification.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 _createUInt8BlockTypeFieldSpecification has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                _createUInt8BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                                                    return {
                                                        fieldId: sprintf('%s_%03d_1_0', fieldIdPrefix, offset),
                                                        name,
                                                        type: this.getTypeById(typeId),
                                            Severity: Minor
                                            Found in src/specification.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

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

                                                    switch (targetUnitCode) {
                                                    case 'WattHours':
                                                        // nop
                                                        break;
                                                    case 'KilowattHours':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 1 day to fix
                                            src/specification.js on lines 906..945

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

                                            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

                                                    switch (sourceUnitCode) {
                                                    case 'WattHours':
                                                        // nop
                                                        break;
                                                    case 'KilowattHours':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 1 day to fix
                                            src/specification.js on lines 947..986

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

                                            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

                                                    switch (sourceUnitCode) {
                                                    case 'LitersPerHour':
                                                        // nop
                                                        break;
                                                    case 'LitersPerMinute':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 3 hrs to fix
                                            src/specification.js on lines 856..874

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

                                            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

                                                    switch (targetUnitCode) {
                                                    case 'LitersPerHour':
                                                        // nop
                                                        break;
                                                    case 'LitersPerMinute':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 3 hrs to fix
                                            src/specification.js on lines 836..854

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

                                            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

                                                    switch (sourceUnitCode) {
                                                    case 'Seconds':
                                                        // nop
                                                        break;
                                                    case 'Minutes':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 2 hrs to fix
                                            src/specification.js on lines 1035..1050

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

                                            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

                                                    switch (targetUnitCode) {
                                                    case 'Seconds':
                                                        // nop
                                                        break;
                                                    case 'Minutes':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 2 hrs to fix
                                            src/specification.js on lines 1018..1033

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

                                            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

                                                    switch (sourceUnitCode) {
                                                    case 'Liters':
                                                        // nop
                                                        break;
                                                    case 'CubicMeters':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 1 hr to fix
                                            src/specification.js on lines 818..830

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

                                            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

                                                    switch (targetUnitCode) {
                                                    case 'Liters':
                                                        // nop
                                                        break;
                                                    case 'CubicMeters':
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 1 hr to fix
                                            src/specification.js on lines 804..816

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

                                            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 (rootType === 'Weektime') {
                                                        textValue = this.i18n.moment((rawValue + 5760) * 60000).utc().format('dd,HH:mm');
                                                        result = textValue + unitText;
                                                    } else if (rootType === 'DateTime') {
                                                        textValue = this.i18n.moment((rawValue + 978307200) * 1000).utc().format('L HH:mm:ss');
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 1 hr to fix
                                            src/specification.js on lines 1117..1146

                                            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 if (rootType === 'DateTime') {
                                                        textValue = this.i18n.moment((rawValue + 978307200) * 1000).utc().format('L HH:mm:ss');
                                                        result = textValue + unitText;
                                                    } else if (precision === 0) {
                                                        textValue = this.i18n.numeral(rawValue).format('0');
                                            Severity: Major
                                            Found in src/specification.js and 1 other location - About 1 hr to fix
                                            src/specification.js on lines 1114..1146

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

                                                            if (start + offset + 2 < end) {
                                                                rawValue = (newValue / 65536) & 255;
                                                                buffer.writeUInt8(rawValue, start + offset + 2);
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1464..1467
                                            src/specification.js on lines 1533..1536
                                            src/specification.js on lines 1541..1544

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

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

                                                            if (start + offset + 1 < end) {
                                                                rawValue = (newValue / 256) & 255;
                                                                buffer.writeUInt8(rawValue, start + offset + 1);
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1464..1467
                                            src/specification.js on lines 1537..1540
                                            src/specification.js on lines 1541..1544

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

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

                                                            if (start + offset + 3 < end) {
                                                                rawValue = (newValue / 16777216) & 255;
                                                                buffer.writeUInt8(rawValue, start + offset + 3);
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1464..1467
                                            src/specification.js on lines 1533..1536
                                            src/specification.js on lines 1537..1540

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

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

                                                            if (start + offset + 1 < end) {
                                                                rawValue = (newValue / 256) & 255;
                                                                buffer.writeUInt8(rawValue, start + offset + 1);
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1533..1536
                                            src/specification.js on lines 1537..1540
                                            src/specification.js on lines 1541..1544

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

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

                                                            if (start + offset + 1 < end) {
                                                                rawValue += buffer.readInt8(start + offset + 1) * 256;
                                                                valid = true;
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1506..1509
                                            src/specification.js on lines 1510..1513
                                            src/specification.js on lines 1514..1517

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

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

                                                            if (start + offset + 2 < end) {
                                                                rawValue += buffer.readUInt8(start + offset + 2) * 65536;
                                                                valid = true;
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1445..1448
                                            src/specification.js on lines 1506..1509
                                            src/specification.js on lines 1514..1517

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

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

                                                            if (start + offset + 3 < end) {
                                                                rawValue += buffer.readUInt8(start + offset + 3) * 16777216;
                                                                valid = true;
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1445..1448
                                            src/specification.js on lines 1506..1509
                                            src/specification.js on lines 1510..1513

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

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

                                                            } else if (section.type === 11) {
                                                                forEachPayload((index, suffix) => {
                                                                    packetFieldSpecs.push(_this._createUInt32BlockTypeFieldSpecification(fieldIdPrefix, 4 + index * 4, 'Fehlermaske' + suffix, 'Number_1_None', 1));
                                                                });
                                                            } else if (section.type === 12) {
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1579..1611
                                            src/specification.js on lines 1599..1611
                                            src/specification.js on lines 1603..1611

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

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

                                                            if (start + offset + 1 < end) {
                                                                rawValue += buffer.readUInt8(start + offset + 1) * 256;
                                                                valid = true;
                                                            }
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1445..1448
                                            src/specification.js on lines 1510..1513
                                            src/specification.js on lines 1514..1517

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

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

                                                            } else if (section.type === 13) {
                                                                forEachPayload((index, suffix) => {
                                                                    packetFieldSpecs.push(_this._createUInt32BlockTypeFieldSpecification(fieldIdPrefix, 4 + index * 4, 'Statusmaske' + suffix, 'Number_1_None', 1));
                                                                });
                                                            } else if (section.type === 14) {
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1579..1611
                                            src/specification.js on lines 1595..1611
                                            src/specification.js on lines 1599..1611

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

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

                                                            } else if (section.type === 5) {
                                                                forEachPayload((index, suffix) => {
                                                                    packetFieldSpecs.push(_this._createUInt32BlockTypeFieldSpecification(fieldIdPrefix, 4 + index * 4, 'Wärmemenge' + suffix, 'Number_1_WattHours', 1));
                                                                });
                                                            } else if (section.type === 8) {
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1595..1611
                                            src/specification.js on lines 1599..1611
                                            src/specification.js on lines 1603..1611

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

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

                                                            } else if (section.type === 12) {
                                                                forEachPayload((index, suffix) => {
                                                                    packetFieldSpecs.push(_this._createUInt32BlockTypeFieldSpecification(fieldIdPrefix, 4 + index * 4, 'Warnungsmaske' + suffix, 'Number_1_None', 1));
                                                                });
                                                            } else if (section.type === 13) {
                                            Severity: Major
                                            Found in src/specification.js and 3 other locations - About 55 mins to fix
                                            src/specification.js on lines 1579..1611
                                            src/specification.js on lines 1595..1611
                                            src/specification.js on lines 1603..1611

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

                                            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

                                                    switch (sourceUnitCode) {
                                                    case 'Bars':
                                                        // nop
                                                        break;
                                                    case 'PoundsForcePerSquareInch':
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 50 mins to fix
                                            src/specification.js on lines 891..900

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

                                            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

                                                    switch (targetUnitCode) {
                                                    case 'DegreesCelsius':
                                                        // nop
                                                        break;
                                                    case 'DegreesFahrenheit':
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 50 mins to fix
                                            src/specification.js on lines 778..787

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

                                            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

                                                    switch (targetUnitCode) {
                                                    case 'Bars':
                                                        // nop
                                                        break;
                                                    case 'PoundsForcePerSquareInch':
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 50 mins to fix
                                            src/specification.js on lines 880..889

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

                                            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

                                                    switch (sourceUnitCode) {
                                                    case 'DegreesCelsius':
                                                        // nop
                                                        break;
                                                    case 'DegreesFahrenheit':
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 50 mins to fix
                                            src/specification.js on lines 789..798

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

                                            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

                                                    switch (sourceUnitCode) {
                                                    case 'Watts':
                                                        // nop
                                                        break;
                                                    case 'Kilowatts':
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 40 mins to fix
                                            src/specification.js on lines 1003..1012

                                            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

                                                    switch (targetUnitCode) {
                                                    case 'Watts':
                                                        // nop
                                                        break;
                                                    case 'Kilowatts':
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 40 mins to fix
                                            src/specification.js on lines 992..1001

                                            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

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

                                                        if (isString(pfsName)) {
                                                            const key = 'specificationData.packetFieldName.' + pfsName;
                                                            name = _this.i18n.t(key);
                                                            if (name === key) {
                                                                name = pfsName;
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 35 mins to fix
                                            src/specification.js on lines 1211..1215

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

                                            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 (isString(pfsName)) {
                                                            name = pfsName;
                                                        } else if (isObject(pfsName)) {
                                                            name = pfsName [language] || pfsName.en || pfsName.de || pfsName.ref;
                                                        }
                                            Severity: Minor
                                            Found in src/specification.js and 1 other location - About 35 mins to fix
                                            src/specification.js on lines 1666..1674

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

                                            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