Whole file
Melevir/cognitive_complexity
The author described this change as “FIX #6: correctly process ternary operator”. It counts as a record because the check below fails on the code as it stood at 59587af24 and passes on 760c9edb9, with nothing else changed between the two runs.
ProjectMelevir/cognitive_complexity
Fix saved2019-11-06
Sharing licenceMIT · LICENSE
Change size+1 −0
What the code was meant to do, written into the code itself as a save note
FIX #6: correctly process ternary operator
The change
| 22 | 22 | ast.If, | |
| 23 | 23 | ast.For, | |
| 24 | 24 | ast.While, | |
| 25 | + | ast.IfExp, | |
| 25 | 26 | ) | |
| 26 | 27 | incrementers_nodes = ( | |
| 27 | 28 | ast.FunctionDef, |
The check that tells the two apart
fail→pass·cognitive_complexity/tests/test_cognitive_complexity.py::test_ternary_operator
Check file cognitive_complexity/tests/test_cognitive_complexity.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it59587af24d00123b47d080ee4011f1aa7d83ae48
Broken version dated2019-11-06
Modulecognitive_complexity.api
Units changedget_cognitive_complexity_for_node
Fingerprint2984a04d0e94d18b
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.