Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid marking required imports as unused #12537

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

charliermarsh
Copy link
Member

Summary

If an import is marked as "required", we should never flag it as unused. In practice, this is rare, since required imports are typically used for __future__ annotations, which are always considered "used".

Closes #12458.

@charliermarsh charliermarsh added the bug Something isn't working label Jul 26, 2024
@charliermarsh charliermarsh changed the base branch from main to charlie/required-imports July 26, 2024 17:15
@charliermarsh charliermarsh force-pushed the charlie/required-import-remove branch from e6ea9f4 to b0bc967 Compare July 26, 2024 17:20
Base automatically changed from charlie/required-imports to main July 26, 2024 17:35
@charliermarsh charliermarsh force-pushed the charlie/required-import-remove branch from b0bc967 to 7546721 Compare July 26, 2024 17:36
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh merged commit e18c45c into main Jul 26, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/required-import-remove branch July 26, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Infinite loop] Parser error with I002 (required imports) and F401 (unused import)
1 participant