danielwippermann/resol-vbus

View on GitHub
src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js

Summary

Maintainability
D
3 days
Test Coverage

Function optimizeSolarConfiguration has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    optimizeSolarConfiguration($) {
        const value = $('Solar_SystemId');

        value.isChanged(() => {
            $(/^Solar_.*/).invalidate();

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

        optimizeSolarWfConfiguration($) {
            $(/^Solar_Wf([0-9]+)_Type$/).forEach((value) => {
                const prefix = '^Solar_Wf' + value.md [1] + '_';
    
                value.in([ 0, '#Frei' ], () => {
    src/configuration-optimizers/resol-deltasol-bx-plus-xxx-configuration-optimizer.js on lines 73..95
    src/configuration-optimizers/resol-deltasol-mx-112-configuration-optimizer.js on lines 81..103
    src/configuration-optimizers/resol-deltasol-slt-102-configuration-optimizer.js on lines 57..79

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

    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

        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

    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

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

        optimizeModuleConfiguration($) {
            $(/^Modul([0-9]+)_Aktiviert$/).isFalse((value) => {
                $('^(Sensor|Relais)[^_]*_Modul' + value.md [1] + '_.*$').ignore();
            });
        }
    src/configuration-optimizers/resol-deltasol-bx-plus-xxx-configuration-optimizer.js on lines 22..26
    src/configuration-optimizers/resol-deltasol-mx-112-configuration-optimizer.js on lines 22..26
    src/configuration-optimizers/resol-deltatherm-hc-xxx-configuration-optimizer.js on lines 21..25

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 60.

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

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

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

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

    Refactorings

    Further Reading

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

            value.isChanged(() => {
                $(/^Solar_.*/).invalidate();
                $(/^Anlage_.*/).invalidate();
                $(/^Heizung_.*/).invalidate();
            });
    src/configuration-optimizers/resol-deltasol-bx-plus-xxx-configuration-optimizer.js on lines 31..35
    src/configuration-optimizers/resol-deltasol-mx-112-configuration-optimizer.js on lines 31..35
    src/configuration-optimizers/resol-deltasol-slt-102-configuration-optimizer.js on lines 23..27

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

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

            value.check(hasMinSpeicherCount(3), () => {
                $(/^Solar_Sp3_.*/).ignore();
                $(/^Solar_Wf3_(ExtWT)_.*/).ignore();
            });
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 59..62
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 63..66
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 67..70
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 86..89
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 90..93

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

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

            value.check(hasMinSpeicherCount(5), () => {
                $(/^Solar_Sp5_.*/).ignore();
                $(/^Solar_Wf5_(ExtWT)_.*/).ignore();
            });
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 59..62
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 63..66
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 67..70
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 82..85
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 86..89

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

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

            value.check(hasMinKollektorCount(1), () => {
                $(/^Solar_Kol1_.*/).ignore();
                $(/^Solar_Wf1_(Roehrenkollektor|Bypass|Frostschutz)_.*/).ignore();
            });
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 63..66
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 67..70
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 82..85
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 86..89
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 90..93

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

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

            value.check(hasMinSpeicherCount(4), () => {
                $(/^Solar_Sp4_.*/).ignore();
                $(/^Solar_Wf4_(ExtWT)_.*/).ignore();
            });
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 59..62
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 63..66
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 67..70
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 82..85
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 90..93

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

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

            value.check(hasMinKollektorCount(3), () => {
                $(/^Solar_Kol3_.*/).ignore();
                $(/^Solar_Wf3_(Roehrenkollektor|Bypass|Frostschutz)_.*/).ignore();
            });
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 59..62
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 63..66
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 82..85
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 86..89
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 90..93

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

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

            value.check(hasMinKollektorCount(2), () => {
                $(/^Solar_Kol2_.*/).ignore();
                $(/^Solar_Wf2_(Roehrenkollektor|Bypass|Frostschutz)_.*/).ignore();
            });
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 59..62
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 67..70
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 82..85
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 86..89
    src/configuration-optimizers/resol-deltasol-mx-2xx-configuration-optimizer.js on lines 90..93

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

    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