Showing 5 of 5 total issues
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 _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"
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 __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, host: str, port: int = 1883,
Function _find_devices
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _find_devices(patterns: List, paths: List[str]) -> Dict[str, InputDevice]:
"""
# Finds the input device with the name ".*Barcode Reader.*".
# Could and should be parameterized, of course. Device name as cmd line parameter, perhaps?
:param patterns: list of patterns to match the device name against
- 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"