0.4.0
Breaking changes
The cognitive complexity now considers the If Expression
used in the code.
Example:
def greet(name, is_morning):
greeting = "Good morning" if is_morning else "Hello"
print(f"{greeting}, {name}!")
greet("Alice", True)
This function has a cognitive complexity of 1 due to the If Expression
used in the variable assignment, this also is considered when using a Call Expression
and so on.
Fixed
Found an edge case that could cause a memory overflow, fixed this by filtering the cognitive complexity of the orelse
values in an If Statement
and kept propagating the nesting level subtraction.
What's Changed
- feat(back): #40 update cognitive complexity algorithm by @rohaquinlop in #44
Full Changelog: 0.3.3...0.4.0