tobi-wan-kenobi/bumblebee-status

View on GitHub

Showing 134 of 263 total issues

Function _eval_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _eval_line(self, line):
        if line.startswith("file "):
            full_file = line[5:]
            file1 = os.path.basename(full_file)
            file2 = os.path.splitext(file1)[0]
Severity: Minor
Found in bumblebee_status/modules/contrib/cmus.py - About 35 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 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 "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 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 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 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 ["clouds"]
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 False
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

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 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 "wheel-down"
Severity: Major
Found in bumblebee_status/core/input.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return "Fully charged"
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 ["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 []
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 "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 "n/a"
Severity: Major
Found in bumblebee_status/core/input.py - About 30 mins to fix

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

    def _check_for_refresh(self):
        if self._feeds_to_update:
            # Update one feed at a time to not overload this update cycle
            url = self._feeds_to_update.pop()
            self._update_items_from_feed(url)
Severity: Minor
Found in bumblebee_status/modules/contrib/rss.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        database_loc = self.parameter(
            "database", "~/.local/share/activitywatch/aw-server/peewee-sqlite.v2.db"
        )
        home = os.path.expanduser("~")
Severity: Minor
Found in bumblebee_status/modules/contrib/usage.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