ruff
b4c75cd7 - [`flake8-builtins`] Expand checks in class scopes (`A001`) (#29076)

Commit
9 days ago
[`flake8-builtins`] Expand checks in class scopes (`A001`) (#29076) ## Summary Inside a class body, `flake8-builtins` reports a `for`, `with ... as`, or `:=` target that shadows a builtin, but A001 does not. The A001 call site skipped every stored name in class scope because A003 handles class attributes, but A003 only considers assignment and annotation bindings, so those other binding kinds were reported by neither rule. The class-scope skip now applies only to the binding kinds A003 handles, by checking the stored name's `BindingKind`. Attribute and method bindings in a class still go to A003, so there's no double-reporting. This is the gap left after #20178, which I picked up because no pull request was opened for it. Fixes #20179 ## Test Plan I have added new class-scope cases in the A001 fixture covering both the three bindings that now fire and the attribute and method bindings that stay silent, updated the snapshot with three new diagnostics, and ran the `flake8-builtins` tests, `clippy`, and `fmt`.
Author
Parents
Loading