tobi-wan-kenobi/bumblebee-status

View on GitHub

Showing 263 of 263 total issues

Avoid too many return statements within this function.
Open

            return 4
Severity: Major
Found in bumblebee_status/util/graph.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return state
Severity: Major
Found in bumblebee_status/modules/contrib/zpool.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return "unknown"
Severity: Major
Found in bumblebee_status/modules/contrib/sensors.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return "Pending charge"
Severity: Major
Found in bumblebee_status/modules/contrib/battery-upower.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return "update"
Severity: Major
Found in bumblebee_status/core/input.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

                return ["sleet"]
Severity: Major
Found in bumblebee_status/modules/contrib/weather.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

                return ["clear"]
Severity: Major
Found in bumblebee_status/modules/contrib/weather.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return self._status
Severity: Major
Found in bumblebee_status/modules/contrib/mpd.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return is_psl(module)
Severity: Major
Found in generate-base-tests.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

                return int(float(match[self._match_number]))
Severity: Major
Found in bumblebee_status/modules/contrib/sensors.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return "Pending discharge"
Severity: Major
Found in bumblebee_status/modules/contrib/battery-upower.py - About 30 mins to fix

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

        elif shutil.which("light"):
            self.__readcmd = self.__light
            self.register_cmd("light -A {}%".format(step), "light -U {}%".format(step))
Severity: Minor
Found in bumblebee_status/modules/contrib/brightness.py and 1 other location - About 30 mins to fix
bumblebee_status/modules/contrib/brightness.py on lines 45..48

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

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

        elif shutil.which("brightnessctl"):
            self.__readcmd = self.__brightnessctl
            self.register_cmd(
                "brightnessctl s {}%+".format(step), "brightnessctl s {}%-".format(step)
Severity: Minor
Found in bumblebee_status/modules/contrib/brightness.py and 1 other location - About 30 mins to fix
bumblebee_status/modules/contrib/brightness.py on lines 42..44

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

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 self._mem["percent"] > float(self.parameter("critical", 90)):
            return "critical"
Severity: Minor
Found in bumblebee_status/modules/core/memory.py and 1 other location - About 30 mins to fix
bumblebee_status/modules/core/memory.py on lines 67..68

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

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 self._mem["percent"] > float(self.parameter("warning", 80)):
            return "warning"
Severity: Minor
Found in bumblebee_status/modules/core/memory.py and 1 other location - About 30 mins to fix
bumblebee_status/modules/core/memory.py on lines 65..66

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

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

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

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

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

Refactorings

Further Reading

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

    @core.decorators.scrollable
    def description(self, widget):
        return string.Formatter().vformat(self._fmt, (), self._tags)
Severity: Minor
Found in bumblebee_status/modules/contrib/cmus.py and 1 other location - About 30 mins to fix
bumblebee_status/modules/contrib/mpd.py on lines 135..137

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

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

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

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

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

Refactorings

Further Reading

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

    @core.decorators.scrollable
    def description(self, widget):
        return string.Formatter().vformat(self._fmt, (), self._tags)
Severity: Minor
Found in bumblebee_status/modules/contrib/mpd.py and 1 other location - About 30 mins to fix
bumblebee_status/modules/contrib/cmus.py on lines 106..108

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

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

    def __init__(self, config, theme):
        super().__init__(config, theme, core.widget.Widget(self.suntimes))

        lat = self.parameter("lat", None)
        lon = self.parameter("lon", None)
Severity: Minor
Found in bumblebee_status/modules/contrib/sun.py - About 25 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function getvolume has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def getvolume(self, line):
        if "mono" in line:
            m = re.search(r"mono:.*\s*\/\s*(\d+)%", line)
            if m:
                self._mono = m.group(1)
Severity: Minor
Found in bumblebee_status/modules/core/pulseaudio.py - About 25 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function widget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def widget(self, name=None, widget_id=None):
        if not name and not widget_id:
            return self.widgets()[0]

        for w in self.widgets():
Severity: Minor
Found in bumblebee_status/core/module.py - About 25 mins to fix

Cognitive Complexity

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

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

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

Further reading

Severity
Category
Status
Source
Language