tobi-wan-kenobi/bumblebee-status

View on GitHub
bumblebee_status/modules/contrib/currency.py

Summary

Maintainability
B
6 hrs
Test Coverage
F
31%

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 price has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def price(self, widget):
        if len(self.__data) == 0:
            return "?"

        rates = []
Severity: Minor
Found in bumblebee_status/modules/contrib/currency.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 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, config, theme):
        super().__init__(config, theme, core.widget.Widget(self.price))

        self.__data = []

Severity: Minor
Found in bumblebee_status/modules/contrib/currency.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

There are no issues that match your filters.

Category
Status