danielwippermann/resol-vbus

View on GitHub

Showing 557 of 557 total issues

Function startMqttLogging has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

const startMqttLogging = async () => {
    const onHeaderSet = async (headerSet, client) => {
        const headers = headerSet.getSortedHeaders();
        const packetFields = specification.getPacketFieldsForHeaders(headers);

Severity: Minor
Found in examples/vbustouch-proxy/index.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 main has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

async function main(argv, options) {
    const args = new ArgParser(argv);

    function usage(message) {
        args.printUsage(message, [
Severity: Minor
Found in examples/customizer2/src/main.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

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

        {
            "type": {
                "valueTexts": [
                    {
                        "value": "0",
src/configuration-optimizers/resol-deltasol-cs-plus-110-data.js on lines 2522..2549

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

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

        {
            "type": {
                "valueTexts": [
                    {
                        "value": "0",
src/configuration-optimizers/resol-deltasol-cs-plus-110-data.js on lines 2494..2521

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

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 _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 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 discover has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function discover() {
          const interfaceMap = os.networkInterfaces();
      
          const interfaceNames = Object.getOwnPropertyNames(interfaceMap);
      
      
      Severity: Major
      Found in examples/discovery/index.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 discover has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          async function discover() {
              const interfaceMap = os.networkInterfaces();
          
              const interfaceNames = Object.getOwnPropertyNames(interfaceMap);
          
          
          Severity: Minor
          Found in examples/discovery/index.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 mergeTypes has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const mergeTypes = function(menuSystem) {
              const typeById = _.reduce(menuSystem.types, (memo, type) => {
                  memo [type.id] = type;
                  return memo;
              }, {});
          Severity: Major
          Found in tools/configuration-importer/index.js - About 2 hrs to fix

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

                optimizeHeizungRelaisConfiguration($) {
                    $(/^(Heizung_Relais(Anforderung|Pumpe|Ventil)[0-9]+)_Type$/).forEach((value) => {
                        const prefix = `^${value.md [1]}_`;
            
                        value.eql(0, () => {
            src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 223..230

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

            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

                static async matchOptimizer(options) {
                    let match;
            
                    if (options.deviceAddress !== 0x7E11) {
                        match = 0;
            src/configuration-optimizers/resol-deltasol-mx-112-configuration-optimizer.js on lines 198..214

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

            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

                optimizeWsuConfiguration($) {
                    $(/^(Wsu[0-9]+)_Belegt$/).forEach((value) => {
                        const prefix = `^${value.md [1]}_`;
                        value.eql(0, () => {
                            $(prefix + '(?!Belegt).*').ignore();
            src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 203..211

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

            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

                static async matchOptimizer(options) {
                    let match;
            
                    if (options.deviceAddress !== 0x7E11) {
                        match = 0;
            src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 232..249

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

            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 _getAdjustableValues has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _getAdjustableValues() {
                    const data = this.constructor.configurationData;
            
                    const typeById = (data.types || []).reduce((memo, type) => {
                        memo [type.id] = type;
            Severity: Major
            Found in src/base-configuration-optimizer.js - About 2 hrs to fix

              Function convertHeaderSet has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  convertHeaderSet(headerSet) {
                      const _this = this;
              
                      const spec = this.specification;
              
              
              Severity: Major
              Found in src/text-converter.js - About 2 hrs to fix

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

                    optimizeWmzConfiguration($) {
                        $(/^(Wmz[0-9]+)_Type$/).forEach((value) => {
                            const prefix = '^' + value.md [1] + '_';
                
                            value.eql(0, () => {
                src/configuration-optimizers/resol-deltasol-bx-plus-xxx-configuration-optimizer.js on lines 180..188
                src/configuration-optimizers/resol-deltasol-mx-112-configuration-optimizer.js on lines 188..196
                src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 213..221
                src/configuration-optimizers/resol-deltasol-slt-102-configuration-optimizer.js on lines 138..146

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

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

                    optimizeWmzConfiguration($) {
                        $(/^(Wmz[0-9]+)_Type$/).forEach((value) => {
                            const prefix = '^' + value.md [1] + '_';
                
                            value.eql(0, () => {
                src/configuration-optimizers/resol-deltasol-bx-plus-xxx-configuration-optimizer.js on lines 180..188
                src/configuration-optimizers/resol-deltasol-mx-112-configuration-optimizer.js on lines 188..196
                src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 213..221
                src/configuration-optimizers/resol-deltatherm-hc-xxx-configuration-optimizer.js on lines 101..109

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

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

                    optimizeWmzConfiguration($) {
                        $(/^(Wmz[0-9]+)_Type$/).forEach((value) => {
                            const prefix = '^' + value.md [1] + '_';
                
                            value.eql(0, () => {
                src/configuration-optimizers/resol-deltasol-bx-plus-xxx-configuration-optimizer.js on lines 180..188
                src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 213..221
                src/configuration-optimizers/resol-deltasol-slt-102-configuration-optimizer.js on lines 138..146
                src/configuration-optimizers/resol-deltatherm-hc-xxx-configuration-optimizer.js on lines 101..109

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

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

                    optimizeWmzConfiguration($) {
                        $(/^(Wmz[0-9]+)_Type$/).forEach((value) => {
                            const prefix = '^' + value.md [1] + '_';
                
                            value.eql(0, () => {
                src/configuration-optimizers/resol-deltasol-bx-plus-xxx-configuration-optimizer.js on lines 180..188
                src/configuration-optimizers/resol-deltasol-mx-112-configuration-optimizer.js on lines 188..196
                src/configuration-optimizers/resol-deltasol-slt-102-configuration-optimizer.js on lines 138..146
                src/configuration-optimizers/resol-deltatherm-hc-xxx-configuration-optimizer.js on lines 101..109

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

                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