mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[ruff
] Check for shadowed map
before suggesting fix (RUF058
) (#15790)
## Summary Fixes #15786 by not suggesting a fix if `map` doesn't have its builtin binding. ## Test Plan New test taken from the report in #15786.
This commit is contained in:
parent
ca53eefa6f
commit
786099a872
6 changed files with 64 additions and 17 deletions
11
crates/ruff_linter/resources/test/fixtures/ruff/RUF058_1.py
vendored
Normal file
11
crates/ruff_linter/resources/test/fixtures/ruff/RUF058_1.py
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
"""Regression test for https://github.com/astral-sh/ruff/issues/15786. This
|
||||
should be separate from other tests because it shadows the `map` builtin.
|
||||
|
||||
This should still get a diagnostic but not a fix that would lead to an error.
|
||||
"""
|
||||
|
||||
from itertools import starmap
|
||||
|
||||
map = {}
|
||||
for _ in starmap(print, zip("A", "12")):
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue