tobi-wan-kenobi/bumblebee-status

View on GitHub
bumblebee_status/core/output.py

Summary

Maintainability
C
1 day
Test Coverage
B
86%

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

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

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 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 __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 assign has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def assign(src, dst, key, src_key=None, default=None):
Severity: Minor
Found in bumblebee_status/core/output.py - About 35 mins to fix

There are no issues that match your filters.

Category
Status