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

[flake8-pyi] Skip all type definitions in string-or-bytes-too-long (PYI053) #14797

Merged
merged 4 commits into from
Dec 6, 2024

Conversation

dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented Dec 5, 2024

This PR skips all type definitions (including annotations, quoted annotations, etc.) for the purposes of string-or-bytes-too-long (PYI053).

Closes #12995 (we hope)
Replaces #13020

@dylwil3 dylwil3 added the rule Implementing or modifying a lint rule label Dec 5, 2024
@dylwil3 dylwil3 requested a review from AlexWaygood as a code owner December 5, 2024 21:23
@@ -59,7 +59,7 @@ pub(crate) fn string_or_bytes_too_long(checker: &mut Checker, string: StringLike
return;
}

if semantic.in_annotation() {
if semantic.in_type_definition() | semantic.in_deferred_type_definition() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NB: All annotations are type definitions (but not conversely).

Copy link
Contributor

github-actions bot commented Dec 5, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

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.

Thank you!!

@dylwil3 dylwil3 merged commit 1bd8fbb into astral-sh:main Dec 6, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

string-or-bytes-too-long (PYI053) flags and removes long strings in Literal, producing invalid type
2 participants