-
Notifications
You must be signed in to change notification settings - Fork 2k
[F821] Improve error message for anext/aiter #13287
Copy link
Copy link
Closed
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Summary
The lint F821 has a false positive with anext.
As pointed out by @MichaReiser, this ultimately is due to having either project.requires-python or tools.ruff.target-version set to a too lower version.
In this instances, it was discovered that Ruff was targeting Python 3.8 (from an erroneous config).
Example
async def foo(iter: AsyncGenerator[str, None]):
assert await anext(iter)Desired Behaviour
Where a symbol is introduced in a more recent version of Python, Ruff should:
- Still raise F821 as it is strictly correct; but also,
- Inform the use Ruff is assuming Python 3.x, and the symbol in question was only introduced in Python 3.y, and nudge the user to set
reures-pythonortarget-version.
Environment
❯ ruff --version
ruff 0.6.4
❯ python --version
Python 3.12.5Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule