Whole file

rubik/radon

The author described this change as fix(visitor): do not count with and async with statements towards CC. It counts as a record because the check below fails on the code as it stood at fc30c7297 and passes on 29a671d4f, with nothing else changed between the two runs.

Fix saved2019-01-26
Sharing licenceMIT · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a save note

fix(visitor): do not count with and async with statements towards CC

The change

206206 self.complexity += len(node.values) - 1
207207 # Ifs, with and assert statements count all as 1.
208208 # Note: Lambda functions are not counted anymore, see #68
209- elif name in ('With', 'If', 'IfExp', 'AsyncWith'):
209+ elif name in ('If', 'IfExp'):
210210 self.complexity += 1
211211 # The For and While blocks count as 1 plus the `else` block.
212212 elif name in ('For', 'While', 'AsyncFor'):

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 itfc30c7297dbd4790ba047a5639cb008555fba04f
Broken version dated2019-01-26
Moduleradon.visitors
Units changedComplexityVisitor
Fingerprintc43e24beac427284
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