Function create_diff_report
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create_diff_report(change_diffs):
"""
Pretty prints the output of the `change_diffs` variable.
:param change_diffs: detected differences as groups of lines with filepath keys and a tuple of
- 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_unified_diff_output
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def parse_unified_diff_output(lines):
"""
Parses the unified diff output of two files.
:param lines: diff lines
- 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
Consider simplifying this complex logical expression. Open
if len(line) > 2 and (line[:3] == "+++" or line[:3] == "---"):
continue
# ignore line range information in the output
elif len(line) > 1 and line[:2] == "@@":
continue
Function assert_change
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assert_change(actual_result, expected_result):
"""
Condition wrapper of the upper method.
:param actual_result: actual added and removed lines with filepath keys and a tuple of
- 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"