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.

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

229229 # In Python 3.3 the TryExcept and TryFinally nodes have been merged
230230 # into a single node: Try
231231 if name in ('Try', 'TryExcept'):
232- self.complexity += len(node.handlers) + len(node.orelse)
232+ self.complexity += len(node.handlers) + bool(node.orelse)
233233 elif name == 'BoolOp':
234234 self.complexity += len(node.values) - 1
235235 # Ifs, with and assert statements count all as 1.

The check that tells the two apart

failpass·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.

Other bugs found in rubik/radon