Function _print
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
def _print(self, text, target_stream) -> None:
"""Write the text to the target stream handling the colors."""
colorized = (config.colorized_output
and self.support_color(target_stream))
colored_line = False
- 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 stream_output
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
def stream_output(self, text, targetStream=None) -> None:
"""Output text to a stream.
If a character can't be displayed in the encoding used by the user's
terminal, it will be replaced with a question mark or by a
- 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
Avoid deeply nested control flow statements. Open
if option.handled(answer):
answer = option.result(answer)
output_option(option, before_question=False)
handled = option.stop
break
Avoid deeply nested control flow statements. Open
if force:
raise ValueError(
f'{default!r} is not a valid Option for '
f'{removeprefix(output, question).lstrip()}')
Function input
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def input(self, question: str,
password: bool = False,
default: str | None = '',
force: bool = False) -> str:
"""
- 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
TODO found Open
# TODO: Test for uniquity
- Exclude checks
TODO found Open
# TODO: make sure this is logged as well
- Exclude checks