Function _code_to_character
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def _code_to_character(self, code: str) -> chr or None:
character = None
if len(code) == 5:
character = code[-1]
- Read upRead up
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 read_line
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def read_line(self, input_device: InputDevice) -> str:
"""
Reads a line
:param input_device: the device to read from
:return: line
- Read upRead up
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 _on_key_event
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def _on_key_event(self, code: str, state: int) -> bool:
if code in ["KEY_ENTER", "KEY_KPENTER"]:
if state == KeyEvent.key_up:
# line is finished
self._reset_modifiers()
- Read upRead up
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"