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

[pyflakes] Visit forward annotations in TypeAliasType as types (F401) #15829

Merged
merged 7 commits into from
Jan 30, 2025

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Jan 30, 2025

Summary

Fixes #15812 by visiting the second argument as a type definition.

Test Plan

New F401 tests based on the report.

@ntBre ntBre added the bug Something isn't working label Jan 30, 2025
@ntBre ntBre requested a review from AlexWaygood January 30, 2025 15:17
Copy link
Contributor

github-actions bot commented Jan 30, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! I have a question about the treatement of kwargs vs positional args

crates/ruff_linter/src/checkers/ast/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@ntBre
Copy link
Contributor Author

ntBre commented Jan 30, 2025

Thank you both again for the reviews! I'll hold off merging until after the release.

@ntBre ntBre merged commit fe516e2 into main Jan 30, 2025
21 checks passed
@ntBre ntBre deleted the brent/forward-type-alias branch January 30, 2025 23:06
dcreager added a commit that referenced this pull request Jan 31, 2025
* main:
  [`flake8-pyi`] Fix several correctness issues with `custom-type-var-return-type` (`PYI019`) (#15851)
  [`pyupgrade`] Reuse replacement logic from `UP046` and `UP047` (`UP040`) (#15840)
  [`refurb`] Avoid `None | None` as well as better detection and fix (`FURB168`) (#15779)
  Remove non-existing `lint.extendIgnore` editor setting (#15844)
  [`refurb`] Mark fix as unsafe if there are comments (`FURB171`) (#15832)
  [`flake8-comprehensions`] Skip when `TypeError` present from too many (kw)args for `C410`,`C411`, and `C418` (#15838)
  [`pyflakes`] Visit forward annotations in `TypeAliasType` as types (`F401`) (#15829)
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.

F401 false positive with TypeAliasType and forward annotation
3 participants