mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 04:48:06 +00:00
[flake8-simplify] Fix false negatives for shadowed bindings (SIM910, SIM911) (#18794)
<!-- Thank you for contributing to Ruff/ty! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? --> ## Summary I also noticed that the tests for SIM911 were note being run, so I fixed that. Fixes #18777 <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan Add regression test <!-- How was it tested? -->
This commit is contained in:
parent
dc160c4a49
commit
ffb09c84f2
7 changed files with 108 additions and 2 deletions
|
|
@ -49,3 +49,9 @@ def foo(some_other: object):
|
|||
# OK
|
||||
def foo(some_other):
|
||||
a = some_other.get('a', None)
|
||||
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/18777
|
||||
def foo():
|
||||
dict = {"Tom": 23, "Maria": 23, "Dog": 11}
|
||||
age = dict.get("Cat", None)
|
||||
|
|
|
|||
|
|
@ -23,3 +23,9 @@ for k, v in zip(d2.keys(), d2.values()): # SIM911
|
|||
items = zip(x.keys(), x.values()) # OK
|
||||
|
||||
items.bar = zip(x.keys(), x.values()) # OK
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/18777
|
||||
def foo():
|
||||
dict = {}
|
||||
for country, stars in zip(dict.keys(), dict.values()):
|
||||
...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue