Function _read_path_or_stdin
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Wontfix
def _read_path_or_stdin(path: Path, mode: Mode) -> Tuple[str, str, str]:
"""
If passed a Path, calls open() and read() and returns contents as
a tuple of strings. The first element is the contents of the file; the
second element is the encoding used to read the file; the third
- Read upRead up
- Create a ticketCreate a ticket
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 get_matching_paths
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_matching_paths(paths: Iterable[Path], mode: Mode) -> Set[Path]:
"""
Takes a list of paths (files or directories) and a mode as an input, and
yields paths to individual files that match the input paths (or are contained in
its directories) and are not excluded by the mode's exclude glob
- Read upRead up
- Create a ticketCreate a ticket
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 _get_included_paths
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_included_paths(paths: Iterable[Path], mode: Mode) -> Set[Path]:
"""
Takes a list of absolute paths (files or directories) and a mode as an input, and
yields paths to individual files that match the input paths (or are contained in
its directories)
- Read upRead up
- Create a ticketCreate a ticket
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 _format_many
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _format_many(
paths: Collection[Path],
cache: Cache,
mode: Mode,
callback: Optional[Callable[[Awaitable[SqlFormatResult]], None]] = None,
- Read upRead up
- Create a ticketCreate a ticket
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"