Whole file
rubik/radon
The author described this change as “fix: CC for try-except-else else blocks with multiple statements (#212)”. It counts as a record because the check below fails on the code as it stood at 1a2042db0 and passes on ae9872914, with nothing else changed between the two runs.
Projectrubik/radon
Fix saved2021-05-08
Sharing licenceMIT · LICENSE
Change size+1 −1
What the code was meant to do, written into the code itself as a save note
fix: CC for try-except-else else blocks with multiple statements (#212)
The change
| 229 | 229 | # In Python 3.3 the TryExcept and TryFinally nodes have been merged | |
| 230 | 230 | # into a single node: Try | |
| 231 | 231 | if name in ('Try', 'TryExcept'): | |
| 232 | - | self.complexity += len(node.handlers) + len(node.orelse) | |
| 232 | + | self.complexity += len(node.handlers) + bool(node.orelse) | |
| 233 | 233 | elif name == 'BoolOp': | |
| 234 | 234 | self.complexity += len(node.values) - 1 | |
| 235 | 235 | # Ifs, with and assert statements count all as 1. |
The check that tells the two apart
fail→pass·radon/tests/test_complexity_visitor.py::test_visitor_simple[\n
Check file radon/tests/test_complexity_visitor.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 it1a2042db00fe6538fa7efee2bb70c187ec7c25dc
Broken version dated2021-05-07
Moduleradon.visitors
Units changedComplexityVisitor
Fingerprintddc79b56b47b3d03
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.