hthiery/python-fritzhome

View on GitHub

Showing 17 of 22 total issues

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

        if device.has_blind:
            print(" Blind:")
            print("  level=%s" % device.level)
            print("  levelpercentage=%s" % device.levelpercentage)
            print("  endpositionset=%s" % device.endpositionsset)
Severity: Major
Found in pyfritzhome/cli.py and 1 other location - About 2 hrs to fix
pyfritzhome/cli.py on lines 43..47

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

        if device.has_powermeter:
            print(" Powermeter:")
            print("  power=%s" % device.power)
            print("  energy=%s" % device.energy)
            print("  voltage=%s" % device.voltage)
Severity: Major
Found in pyfritzhome/cli.py and 1 other location - About 2 hrs to fix
pyfritzhome/cli.py on lines 78..82

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

    def _update_blind_from_node(self, node):
        _LOGGER.debug("update blind device")
        blind_element = node.find("blind")
        try:
            self.endpositionsset = self.get_node_value_as_int_as_bool(
Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedeviceblind.py and 1 other location - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 31..38

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

    def _update_humidity_from_node(self, node):
        _LOGGER.debug("update humidity device")
        humidity_element = node.find("humidity")
        try:
            self.rel_humidity = self.get_node_value_as_int(
Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicehumidity.py and 1 other location - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 31..38

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicelevel.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicealarm.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedeviceblind.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicethermostat.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicelightbulb.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedeviceswitch.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicehumidity.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicetemperature.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def _update_from_node(self, node):
        super()._update_from_node(node)
        if self.present is False:
            return

Severity: Major
Found in pyfritzhome/devicetypes/fritzhomedevicepowermeter.py and 8 other locations - About 1 hr to fix
pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

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

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

    def set_unmapped_color(self, hsv, duration=0):
        """Set unmapped HSV color (Free color selection)."""
        if self.has_color:
            self._fritz.set_color(self.ain, hsv, duration, False)
Severity: Minor
Found in pyfritzhome/devicetypes/fritzhomedevicelightbulb.py and 1 other location - About 45 mins to fix
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 116..119

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

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

    def set_color(self, hsv, duration=0):
        """Set HSV color."""
        if self.has_color:
            self._fritz.set_color(self.ain, hsv, duration, True)
Severity: Minor
Found in pyfritzhome/devicetypes/fritzhomedevicelightbulb.py and 1 other location - About 45 mins to fix
pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 121..124

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

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

        try:
            self.battery_low = self.get_node_value_as_int_as_bool(node, "batterylow")
            self.battery_level = int(self.get_node_value_as_int(node, "battery"))
Severity: Minor
Found in pyfritzhome/devicetypes/fritzhomedevicebase.py and 1 other location - About 35 mins to fix
pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 70..75

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

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

            if hkr_element.find("batterylow") is not None:
                self.battery_low = self.get_node_value_as_int_as_bool(
                    hkr_element, "batterylow"
                )
                self.battery_level = int(
Severity: Minor
Found in pyfritzhome/devicetypes/fritzhomedevicethermostat.py and 1 other location - About 35 mins to fix
pyfritzhome/devicetypes/fritzhomedevicebase.py on lines 63..65

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

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