danielwippermann/resol-vbus

View on GitHub

Showing 557 of 557 total issues

Function _processBuffer has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    _processBuffer(chunk, endOfStream, processRecord) {
        let buffer;
        if (this.rxBuffer) {
            buffer = Buffer.concat([ this.rxBuffer, chunk ]);
        } else {
Severity: Minor
Found in src/vbus-recording-converter.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

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

            const params = Object.keys(config.mqttPacketFieldMap).reduce((memo, key) => {
                const packetFieldId = config.mqttPacketFieldMap [key];

                let value;
                if (typeof packetFieldId === 'function') {
Severity: Major
Found in examples/vbustouch-proxy/index.js and 1 other location - About 4 hrs to fix
examples/vbustouch-proxy/index.js on lines 557..573

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

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

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

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

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

Refactorings

Further Reading

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

        const params = Object.keys(config.pvOutputOrgPacketFieldMap).reduce((memo, key) => {
            const packetFieldId = config.pvOutputOrgPacketFieldMap [key];

            let value;
            if (typeof packetFieldId === 'function') {
Severity: Major
Found in examples/vbustouch-proxy/index.js and 1 other location - About 4 hrs to fix
examples/vbustouch-proxy/index.js on lines 483..499

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

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

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

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

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

Refactorings

Further Reading

Function 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

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

    convertHeaderSet(headerSet) {
        const _this = this;

        const spec = this.specification;

Severity: Minor
Found in src/text-converter.js - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function processDownloadDownloadRequest has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const processDownloadDownloadRequest = async (req, res) => {
    try {
        const i18n = specification.i18n;

        const startDate = req.query.startDate ? i18n.momentUtc(req.query.startDate, 'MM/DD/YYYY') : i18n.momentUtc();
Severity: Major
Found in examples/vbustouch-proxy/index.js - About 4 hrs to fix

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

          _emitEnd() {
              const spec = this.specification;
      
              const allHeaders = this.allHeaderSet.getHeaders();
      
      
      Severity: Minor
      Found in src/dlx-json-converter.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 onLine has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  const onLine = function(line) {
                      let newPhase = -1;
                      if (line [0] === '+') {
                          if (phase === 0) {
                              if (_this.viaTag) {
      Severity: Major
      Found in src/tcp-connection.js - About 3 hrs to fix

        Function completeConfiguration has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async completeConfiguration(...configs) {
                const _this = this;
        
                const adjustableValues = _this._getAdjustableValues();
        
        
        Severity: Major
        Found in src/base-configuration-optimizer.js - About 3 hrs to fix

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

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

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 109.

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

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

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

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

          Refactorings

          Further Reading

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

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

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 109.

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

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

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

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

          Refactorings

          Further Reading

          Function _processRecord has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _processRecord(buffer) {
                  const type = buffer [1] & 0x0F;
                  const timestamp = moreints.readUInt64LE(buffer, 6);
          
                  if (type === 3) {
          Severity: Major
          Found in src/vbus-recording-converter.js - About 3 hrs to fix

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

            Function _connect has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _connect() {
                    return new Promise((resolve, reject) => {
                        let cleanup = () => { reject(new Error('Called too soon')); };
            
                        const options = {
            Severity: Major
            Found in src/serial-connection.js - About 3 hrs to fix

              Function _emitEnd has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _emitEnd() {
                      const spec = this.specification;
              
                      const allHeaders = this.allHeaderSet.getHeaders();
              
              
              Severity: Major
              Found in src/dlx-json-converter.js - About 3 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 runSingleShot has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const runSingleShot = async (argv) => {
                    const context = {};
                
                    try {
                        if (argv.q) {
                Severity: Major
                Found in examples/customizer/index.js - About 3 hrs to fix

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

                      "languages": [
                          {
                              "texts": [
                                  {
                                      "text": "Deutsch",
                  Severity: Major
                  Found in src/configuration-optimizers/resol-deltasol-c-104-data.js and 1 other location - About 3 hrs to fix
                  src/configuration-optimizers/resol-deltasol-bs4v2-103-data.js on lines 4..41

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language