tobi-wan-kenobi/bumblebee-status

View on GitHub

Showing 134 of 263 total issues

Function get_redshift_value has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def get_redshift_value(module):
    widget = module.widget()
    location = module.parameter("location", "auto")
    lat = module.parameter("lat", None)
    lon = module.parameter("lon", None)
Severity: Minor
Found in bumblebee_status/modules/core/redshift.py - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
Open

    def state(self, widget):
        state = []
        capacity = widget.get("capacity", -1)
        if capacity < 0:
            return ["critical", "unknown"]
Severity: Minor
Found in bumblebee_status/modules/contrib/battery-upower.py - About 2 hrs 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 __fetch_from_calendar has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def __fetch_from_calendar(self):
        SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"]

        creds = None

Severity: Minor
Found in bumblebee_status/modules/contrib/gcalendar.py - About 2 hrs 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

File output.py has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import sys
import json
import time
import threading

Severity: Minor
Found in bumblebee_status/core/output.py - About 2 hrs to fix

Function _update_widgets has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_widgets(self, widgets):
        self.clear_widgets()
        interfaces = []
        for i in netifaces.interfaces():
            if not self._excluded(i) and self._included(i):
Severity: Minor
Found in bumblebee_status/modules/core/nic.py - About 2 hrs 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 toggle_pihole_status has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def toggle_pihole_status(self, widget):
        if self._pihole_status is not None:
            try:
                req = None
                if self._pihole_status:
Severity: Minor
Found in bumblebee_status/modules/contrib/pihole.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self, force=False):
        if not (self._autoupdate or force or not self._initialized):
            return

        self.clear_widgets()
Severity: Minor
Found in bumblebee_status/modules/core/xrandr.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 dependencies has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def dependencies(filename):
    deps = []
    with open(filename) as f:
        for line in f:
            if "import" in line:
Severity: Minor
Found in generate-base-tests.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 load_config has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def load_config(self, filename, content=None):
        if os.path.exists(filename) or content != None:
            log.info("loading {}".format(filename))
            tmp = RawConfigParser()
            tmp.optionxform = str
Severity: Minor
Found in bumblebee_status/core/config.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 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, key, widget=None, default=None):
        if not widget:
            widget = core.widget.Widget("")
        # special handling
        if widget == "previous":
Severity: Minor
Found in bumblebee_status/core/theme.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 __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, config, theme):
        super().__init__(config, theme, [])

        self._layout = self.parameter(
            "layout", "cmus.prev cmus.main cmus.next cmus.shuffle cmus.repeat"
Severity: Minor
Found in bumblebee_status/modules/contrib/cmus.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 merge has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def merge(target, *args):
    """Merges arbitrary data - copied from http://blog.impressiver.com/post/31434674390/deep-merge-multiple-python-dicts

    :param target: the data structure to fill
    :param args: a list of data structures to merge into target
Severity: Minor
Found in bumblebee_status/util/algorithm.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 14 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        state = {}
        self.clear_widgets()
        try:
            directory = util.cli.execute("xcwd").strip()
Severity: Minor
Found in bumblebee_status/modules/core/git.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_temp_from_sensors has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_temp_from_sensors(self):
        if self._json == True:
            try:
                output = json.loads(util.cli.execute("sensors -j"))
                for key in self.parameter("path").split("/"):
Severity: Minor
Found in bumblebee_status/modules/contrib/sensors.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 load_keywords has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def load_keywords(self, name):
        try:
            if isinstance(name, dict):
                return name

Severity: Minor
Found in bumblebee_status/core/theme.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_layouts has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def get_layouts(self):
        try:
            res = util.cli.execute("setxkbmap -query")
        except RuntimeError:
            return ["n/a"]
Severity: Minor
Found in bumblebee_status/modules/contrib/layout.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_temp has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def get_temp(self):
        if self.use_sensors:
            log.debug("Retrieve temperature from sensors -u")
            return self._get_temp_from_sensors()
        try:
Severity: Minor
Found in bumblebee_status/modules/contrib/sensors.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 display has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def display(self, widget):
        if self._failed == True:
            return "n/a"

        vol = None
Severity: Minor
Found in bumblebee_status/modules/core/pulseaudio.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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, config, theme):
        super().__init__(config, theme, [])

        self.__layout = self.parameter(
            "layout", "cpu2.maxfreq cpu2.cpuload cpu2.coresload cpu2.temp cpu2.fanspeed"
Severity: Minor
Found in bumblebee_status/modules/contrib/cpu2.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_pacman_info has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def get_pacman_info(widget, path):
    cmd = utility("pacman-updates")
    result = util.cli.execute(cmd, ignore_errors=True)

    count = len(repos) * [0]
Severity: Minor
Found in bumblebee_status/modules/contrib/pacman.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

Severity
Category
Status
Source
Language