Showing 59 of 61 total issues
Function rebuild_import
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rebuild_import(
import_stmnt: str,
used_names: Set[str],
path: Path,
location: NodeLocation,
- 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 _insert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _insert(
rebuilt_import: List[str],
updated_lines: List[str],
location: NodeLocation,
) -> List[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
Function _get_used_names
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_used_names(
self, node: Union[Import, ImportFrom], is_star: bool
) -> Set[str]:
"""Get set of used names base on given `node` and `self._source_stats`.
- 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 get_stats
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_stats(self) -> Set[str]:
if self._path.name == "__init__.py":
for path in os.listdir(self._path.parent):
file_path = self._path.parent.joinpath(path)
if file_path.is_dir() or path.endswith(".py"):
- 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 too many return
statements within this function. Open
return assumption
Avoid too many return
statements within this function. Open
return path
Avoid too many return
statements within this function. Open
return False
Function strpath
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def strpath(path: Path) -> str:
"""Custom `Path` to `str` casting.
:param path: file-system path.
:returns: stringified path.
- 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 ignored_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ignored_path(self, ignored_path: Path, type_: str) -> None:
"""Increment `self._ignored_paths`. Write a message to stderr.
:param ignored_path: the ignored path.
:param type_: ignore type (`exclude`, `include`, `gitignore` or `nopycln`).
- 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 get_gitignore
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_gitignore(root: Path, no_gitignore: bool = False) -> PathSpec:
"""Return a PathSpec matching gitignore content, if present.
:param root: root path to search for `.gitignore`.
:param no_gitignore: `config.no_gitignore` value (default=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 get_local_import_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_local_import_path(path: Path, module: str) -> Optional[Path]:
"""Find the given local module file.py/__init_.py path.
Written FOR `ast.Import`.
- 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 secho
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def secho(
message: str,
*, # Force kwargs.
bold: bool,
isedit: bool = 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 _compute_not_side_effects
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _compute_not_side_effects(
self, node: Union[ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef]
) -> None:
# Mark any call inside the given `node` as not-side-effect.
for node_ in ast.iter_child_nodes(node):
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
path: Path,
err: Union[SyntaxError, IndentationError, ValueError],
):
- 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 _has_used
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _has_used(self, name: str, is_star: bool) -> bool:
"""Check if the given import name has used.
:param name: a name to check.
:param is_star: is it a '*' import.
- 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 _parse_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _parse_string(
self, node: Union[ast.Constant, ast.Str], is_str_annotation: bool = False
) -> None:
try:
# Parse string names/attrs.
- 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 _visit_type_comment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _visit_type_comment(
self, node: Union[ast.Assign, ast.arg, FunctionDefT]
) -> None:
#: Support Python ^3.8 type comments.
#:
- 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 _has_side_effects
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _has_side_effects( # pylint: disable=dangerous-default-value
self, module: str, node: Union[Import, ImportFrom], *, cache: dict = {}
) -> scan.HasSideEffects:
"""Check if the given import file tree has side effects.
- 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 _visit_string_type_annotation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _visit_string_type_annotation(
self, node: Union[ast.AnnAssign, ast.arg, FunctionDefT]
) -> None:
# Support string type annotations.
if isinstance(node, (ast.AnnAssign, ast.arg)):
- 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"