best-doctor/mr_proper

View on GitHub
mr_proper/utils/ast_pure.py

Summary

Maintainability
B
5 hrs
Test Coverage
C
77%

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]:
Severity: Minor
Found in mr_proper/utils/ast_pure.py - About 2 hrs to fix

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
Severity: Minor
Found in mr_proper/utils/ast_pure.py - About 1 hr to fix

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:
Severity: Minor
Found in mr_proper/utils/ast_pure.py - About 45 mins to fix

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]:
Severity: Minor
Found in mr_proper/utils/ast_pure.py - About 25 mins to fix

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

There are no issues that match your filters.

Category
Status