tobi-wan-kenobi/bumblebee-status

View on GitHub

Showing 134 of 263 total issues

Function assign has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def assign(src, dst, key, src_key=None, default=None):
    if not src_key:
        if key.startswith("_"):
            src_key = key
        else:
Severity: Minor
Found in bumblebee_status/core/output.py - About 1 hr 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 get_chars has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_chars(self):
        if self.value == 100:
            return self.bars[-1] * self.width
        if self.width == 1:
            for i in range(len(VBar.bars)):
Severity: Minor
Found in bumblebee_status/util/graph.py - About 1 hr 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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        widget = self.widget()

        try:
            util.location.reset()
Severity: Minor
Found in bumblebee_status/modules/contrib/publicip.py - About 1 hr 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 state has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def state(self, widget):
        if self.__valid:
            if "thunderstorm" in self.__weather:
                return ["thunder"]
            elif "drizzle" in self.__weather:
Severity: Minor
Found in bumblebee_status/modules/contrib/weather.py - About 55 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 __refresh_temperatures has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __refresh_temperatures(
        self, root, printer_bed_temperature_label, tools_temperature_label
    ):
        actual_bed_temp, target_bed_temp = self.__get_printer_bed_temperature()
        if actual_bed_temp is None:
Severity: Minor
Found in bumblebee_status/modules/contrib/octoprint.py - About 55 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 state has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def state(self, widget):
        states = []

        if widget.get("state") == "down":
            states.append("critical")
Severity: Minor
Found in bumblebee_status/modules/core/nic.py - About 55 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        """Update current state."""
        if not os.path.exists(self._path):
            self._status = "?"
            return
Severity: Minor
Found in bumblebee_status/modules/contrib/bluetooth.py - About 55 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        if self.pomodoro["state"] == "ON":
            timediff = datetime.datetime.now() - self.time
            if timediff.seconds >= 0:
                self.remaining_time -= timediff
Severity: Minor
Found in bumblebee_status/modules/contrib/pomodoro.py - About 55 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 capacity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def capacity(self, widget):
        if widget.name == "all-batteries":
            capacity = self.__manager.capacity_all(self._batteries)
        else:
            capacity = self.__manager.capacity(widget.name)
Severity: Minor
Found in bumblebee_status/modules/contrib/battery.py - About 55 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 create_widgets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def create_widgets(self):
        if self.display == "combined" or self.display == "combined_singles":
            widget = self.add_widget()
            widget.set("device", "combined")
            widget.set("assessment", self.combined())
Severity: Minor
Found in bumblebee_status/modules/contrib/smartstatus.py - About 55 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 execute has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def execute(
Severity: Major
Found in bumblebee_status/util/cli.py - About 50 mins to fix

Function update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        status_line = ""
        for line in (
            util.cli.execute("xset q", ignore_errors=True).replace(" ", "").split("\n")
        ):
Severity: Minor
Found in bumblebee_status/modules/contrib/indicator.py - About 45 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

Avoid deeply nested control flow statements.
Open

                            if include_chip_field:
                                if all(
                                    [
                                        i.split(".")[1] not in field
                                        for i in include_chip_field
Severity: Major
Found in bumblebee_status/modules/core/sensors2.py - About 45 mins to fix

Function capacity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def capacity(self, widget):
        widget.set("capacity", -1)
        widget.set("ac", False)
        output = "n/a"
        if not self.power.is_battery_present(self.device):
Severity: Minor
Found in bumblebee_status/modules/contrib/battery-upower.py - About 45 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 increase_volume has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def increase_volume(self, event):
        if self._limit > 0:  # we need to check the limit
            left = int(self._left)
            right = int(self._right)
            if (
Severity: Minor
Found in bumblebee_status/modules/core/pulseaudio.py - About 45 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 _prune_layouts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _prune_layouts(layouts, displays):
        """Return a list of layouts whose displays are actually connected."""
        available = []
        for layout, needs in layouts.items():
            still_valid = True
Severity: Minor
Found in bumblebee_status/modules/contrib/arandr.py - About 45 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

Avoid deeply nested control flow statements.
Open

                            if "xrandr" not in s_line:
                                continue
                            displays_in_file = Module._parse_layout(line)
Severity: Major
Found in bumblebee_status/modules/contrib/arandr.py - About 45 mins to fix

Function formatStringBuilder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def formatStringBuilder(s, json):
    """
    Parses Format Strings
    Parameter:
        s -> format string
Severity: Minor
Found in bumblebee_status/modules/contrib/spaceapi.py - About 45 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 __content_block has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __content_block(self, module, widget):
        blk = block(self.__theme, module, widget)
        minwidth = widget.theme("minwidth")
        if minwidth is not None:
            try:
Severity: Minor
Found in bumblebee_status/core/output.py - About 45 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 state has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def state(self, widget):
        if widget.name == "mpd.shuffle":
            return "shuffle-on" if self._shuffle else "shuffle-off"
        if widget.name == "mpd.repeat":
            return "repeat-on" if self._repeat else "repeat-off"
Severity: Minor
Found in bumblebee_status/modules/contrib/mpd.py - About 45 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