Skip to content

[pyupgrade] Handle end-of-line comments for quoted-annotation (UP037)#15824

Merged
dylwil3 merged 4 commits intoastral-sh:mainfrom
dylwil3:quoted-annots
Jan 30, 2025
Merged

[pyupgrade] Handle end-of-line comments for quoted-annotation (UP037)#15824
dylwil3 merged 4 commits intoastral-sh:mainfrom
dylwil3:quoted-annots

Conversation

@dylwil3
Copy link
Copy Markdown
Collaborator

@dylwil3 dylwil3 commented Jan 30, 2025

This PR uses the tokens of the parsed annotation available in the Checker, instead of re-lexing (using SimpleTokenizer) the annotation. This avoids some limitations of the SimpleTokenizer, such as not being able to handle number and string literals.

Closes #15816 .

@dylwil3 dylwil3 added bug Something isn't working fixes Related to suggested fixes for violations labels Jan 30, 2025
@github-actions
Copy link
Copy Markdown
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.

Comment thread crates/ruff_linter/src/rules/pyupgrade/rules/quoted_annotation.rs Outdated
Comment thread crates/ruff_linter/src/rules/pyupgrade/rules/quoted_annotation.rs Outdated
@dylwil3 dylwil3 merged commit 56f956a into astral-sh:main Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixes Related to suggested fixes for violations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UP037 fix crashes when a terminal comment follows a literal

2 participants