Showing 15 of 15 total issues
Function get_not_pure_internal_calls
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_not_pure_internal_calls(
funcdef_node: AnyFuncdef,
file_ast_tree: ast.Module,
pyfilepath: str,
) -> 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 not_mutates_args
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def not_mutates_args(funcdef_node: AnyFuncdef, file_ast_tree: Optional[ast.Module]) -> List[str]:
args_names = {a.arg for a in funcdef_node.args.args}
mutating_actions = [ # noqa
( # n +=
ast.AugAssign,
- 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_name_import_path
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_name_import_path(name_node: ast.Name, pyfilepath: str) -> Optional[EntityImportInfo]:
current_node = name_node.parent # type: ignore
while True:
for child in ast.iter_child_nodes(current_node):
# check for Import, not only ImportFrom
- 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 not_has_forbidden_arguments_types
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def not_has_forbidden_arguments_types(
funcdef_node: AnyFuncdef,
file_ast_tree: Optional[ast.Module],
extra_forbidden_argument_type_names: List[str] = None,
) -> 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 is_function_pure
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_function_pure( # noqa: F811
Function check_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_file(path_to_file: str, recursive: bool) -> None:
ast_tree = get_ast_tree(path_to_file)
if not ast_tree:
sys.stdout.write('Error parsing ast tree\n')
return
- 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_funcdef_by
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_funcdef_by(import_info: EntityImportInfo) -> Optional[AnyFuncdef]:
file_path = import_info['file_path']
if file_path:
ast_tree = get_ast_tree(file_path)
if not ast_tree:
- 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_var_names_from_funcdef
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_local_var_names_from_funcdef(funcdef_node: AnyFuncdef) -> List[str]:
local_vars_names: List[str] = []
for assign_node in get_nodes_from_funcdef_body(funcdef_node, [ast.Assign]):
for target in assign_node.targets:
local_vars_names += [n.id for n in ast.walk(target) if isinstance(n, ast.Name)]
- 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 is_function_pure
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_function_pure( # noqa: F811
Function is_function_pure
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_function_pure( # noqa: F811
funcdef_node: AnyFuncdef,
file_ast_tree: ast.Module = None,
with_errors: bool = False,
recursive: 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 is_function_pure
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_function_pure(
Function has_no_blacklisted_calls
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def has_no_blacklisted_calls(
funcdef_node: AnyFuncdef,
file_ast_tree: Optional[ast.Module],
) -> List[str]:
errors: 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_all_global_import_nodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_all_global_import_nodes(file_ast_tree: ast.AST) -> List[Union[ast.ImportFrom, ast.Import]]:
nodes_with_local_scope = {ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef}
import_nodes: List[Union[ast.ImportFrom, ast.Import]] = []
for node in getattr(file_ast_tree, 'body', []):
- 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_file_path_by
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_file_path_by(
import_path: str,
imported_name: str,
dynamic_resolver: bool = False,
) -> Optional[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 is_imported_from_stdlib
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def is_imported_from_stdlib(name: str, file_ast_tree: ast.Module) -> Optional[bool]:
for import_node in get_all_global_import_nodes(file_ast_tree):
for full_import_path in get_full_import_pathes(import_node):
if full_import_path.split('.')[-1] == name:
base_module = full_import_path.split('.')[0]
- 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"