Function _read_details_txt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _read_details_txt(file_contents: str) -> dict:
"""Parse the contents of a daplink-compatible device's details.txt.
Args:
file_contents: The contents of the details.txt file.
- 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_htm_file_contents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def _read_htm_file_contents(all_files: Iterable[pathlib.Path]) -> List[str]:
htm_files_contents = []
for file in all_files:
if _is_htm_file(file):
contents = _try_read_file_text(file)
- 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_first_details_txt_contents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def _read_first_details_txt_contents(file_paths: Iterable[pathlib.Path]) -> dict:
for path in file_paths:
if _is_details_txt(path):
contents = _try_read_file_text(path)
if contents:
- 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"