-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[pycodestyle
]: Make blank lines in typing stub files optional (E3*
)
#10098
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MichaReiser
added
bug
Something isn't working
preview
Related to preview mode features
labels
Feb 23, 2024
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR0917 | 94 | 47 | 47 | 0 | 0 |
E302 | 65 | 0 | 65 | 0 | 0 |
E301 | 16 | 0 | 16 | 0 | 0 |
PLR0904 | 12 | 6 | 6 | 0 | 0 |
PLW1641 | 4 | 2 | 2 | 0 | 0 |
E303 | 2 | 2 | 0 | 0 | 0 |
E305 | 2 | 0 | 2 | 0 | 0 |
snowsignal
approved these changes
Feb 23, 2024
MichaReiser
force-pushed
the
blank-lines-isort
branch
2 times, most recently
from
March 1, 2024 15:53
2fcdfbb
to
066cc98
Compare
MichaReiser
force-pushed
the
blank-lines-typing-stub
branch
2 times, most recently
from
March 1, 2024 16:25
3049521
to
1703c92
Compare
MichaReiser
changed the title
E3: Adjust expected blank lines for typing stub files
[Mar 1, 2024
pycodestyle
]: Make blank lines in typing stub files optional (E3*
)
MichaReiser
force-pushed
the
blank-lines-isort
branch
from
March 5, 2024 10:02
425e2d1
to
7bd7e71
Compare
MichaReiser
force-pushed
the
blank-lines-typing-stub
branch
2 times, most recently
from
March 5, 2024 10:29
6bf8c21
to
e2c06ca
Compare
MichaReiser
force-pushed
the
blank-lines-typing-stub
branch
from
March 5, 2024 10:30
e2c06ca
to
92b9ff8
Compare
nkxxll
pushed a commit
to nkxxll/ruff
that referenced
this pull request
Mar 10, 2024
…`) (astral-sh#10098) ## Summary Fixes astral-sh#10039 The [recommendation for typing stub files](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines) is to use **one** blank line to group related definitions and otherwise omit blank lines. The newly added blank line rules (`E3*`) didn't account for typing stub files and enforced two empty lines at the top level and one empty line otherwise, making it impossible to group related definitions. This PR implements the `E3*` rules to: * Not enforce blank lines. The use of blank lines in typing definitions is entirely up to the user. * Allow at most one empty line, including between top level statements. ## Test Plan Added unit tests (It may look odd that many snapshots are empty but the point is that the rule should no longer emit diagnostics)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10039
The recommendation for typing stub files is to use one blank line to group related definitions and
otherwise omit blank lines.
The newly added blank line rules (
E3*
) didn't account for typing stub files and enforced two empty lines at the top level and one empty line otherwise, making it impossible to group related definitions.This PR implements the
E3*
rules to:Test Plan
Added unit tests (It may look odd that many snapshots are empty but the point is that the rule should no longer emit diagnostics)