tobi-wan-kenobi/bumblebee-status

View on GitHub

Showing 134 of 263 total issues

Function __create_widgets has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
Open

    def __create_widgets(self):
        show_temp = util.format.asbool(self.parameter("showtemp", True))
        show_fan = util.format.asbool(self.parameter("showfan", True))
        show_other = util.format.asbool(self.parameter("showother", False))
        include_chip = tuple(
Severity: Minor
Found in bumblebee_status/modules/core/sensors2.py - About 1 day 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 35 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        widget = self.widget()
        res = util.cli.execute("dnf updateinfo", ignore_errors=True)

        security = 0
Severity: Minor
Found in bumblebee_status/modules/contrib/dnf.py - About 5 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 _update_widgets has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_widgets(self):
        interfaces = [
            i for i in netifaces.interfaces() if not i.startswith(self._exclude)
        ]

Severity: Minor
Found in bumblebee_status/modules/contrib/traffic.py - About 4 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 currency.py has 340 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: UTF-8 -*-
# pylint: disable=C0111,R0903

"""Displays currency exchange rates. Currently, displays currency between GBP and USD/EUR only.

Severity: Minor
Found in bumblebee_status/modules/contrib/currency.py - About 4 hrs to fix

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

    def update(self):
        sp = util.cli.execute("nvidia-smi -q", ignore_errors=True)

        title = ""
        usedMem = ""
Severity: Minor
Found in bumblebee_status/modules/contrib/nvidiagpu.py - About 3 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 print_modules has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def print_modules(self):
        basepath = os.path.abspath(
            os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
        )

Severity: Minor
Found in bumblebee_status/core/config.py - About 3 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 _load_song has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def _load_song(self):
        info = ""
        tags = [
            "name",
            "artist",
Severity: Minor
Found in bumblebee_status/modules/contrib/mpd.py - About 3 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 battery-upower.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# UPowerManger Class Copyright (C) 2017 Oscar Svensson (wogscpar) under MIT licence from upower-python

"""Displays battery status, remaining percentage and charging information.

Parameters:
Severity: Minor
Found in bumblebee_status/modules/contrib/battery-upower.py - About 3 hrs to fix

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

    def update(self):
        self.clear_widgets()
        zfs_version_path = "/sys/module/zfs/version"
        # zpool list -H: List all zpools, use script mode (no headers and tabs as separators).
        try:
Severity: Minor
Found in bumblebee_status/modules/contrib/zpool.py - About 3 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 rss.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# pylint: disable=C0111,R0903

"""RSS news ticker

Fetches rss news items and shows these as a news ticker.
Severity: Minor
Found in bumblebee_status/modules/contrib/rss.py - About 3 hrs to fix

Function __parse has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def __parse(self, data):
        output = {}
        package = ""
        adapter = None
        chip = None
Severity: Minor
Found in bumblebee_status/modules/core/sensors2.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 scrollable has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def scrollable(func):
    def wrapper(module, widget):
        text = func(module, widget)
        if not text:
            return text
Severity: Minor
Found in bumblebee_status/core/decorators.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 blocks has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def blocks(self, module):
        blocks = []
        if module.minimized:
            blocks.extend(self.separator_block(module, module.widgets()[0]))
            blocks.append(self.__content_block(module, module.widgets()[0]))
Severity: Minor
Found in bumblebee_status/core/output.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 config.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import ast

from configparser import RawConfigParser

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

Function execute has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def execute(
    cmd,
    wait=True,
    ignore_errors=False,
    include_stderr=False,
Severity: Minor
Found in bumblebee_status/util/cli.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 update2 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def update2(self, affected_modules=None, redraw_only=False, force=False):
        now = time.time()
        for module in self.__modules:
            if affected_modules and not module.id in affected_modules:
                continue
Severity: Minor
Found in bumblebee_status/core/output.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 __init__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

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

        self.background = True

Severity: Minor
Found in bumblebee_status/modules/contrib/spotify.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 update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        playback_status = self.status()
        if not playback_status:
            self.__hidden = self.__hide
        else:
Severity: Minor
Found in bumblebee_status/modules/contrib/playerctl.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 update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self):
        try:
            self._failed = False
            channel = "sinks" if self._channel == "sink" else "sources"
            self.__selected_default_device = self._default_device()
Severity: Minor
Found in bumblebee_status/modules/core/pulseaudio.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 18 (exceeds 5 allowed). Consider refactoring.
Open

    def state(self, widget):
        state = []
        capacity = widget.get("capacity")

        if capacity < 0:
Severity: Minor
Found in bumblebee_status/modules/contrib/battery.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

Severity
Category
Status
Source
Language