Add empty lines before nested functions and classes#6206
Merged
charliermarsh merged 1 commit intomainfrom Aug 1, 2023
Merged
Conversation
eff492c to
4b4f3fd
Compare
Contributor
PR Check ResultsBenchmarkLinuxWindows |
c7c4e82 to
5391d50
Compare
1e4b76d to
c046c4a
Compare
8a36ffa to
6882acf
Compare
c046c4a to
17f5446
Compare
MichaReiser
approved these changes
Aug 1, 2023
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Note that this only applies when the function or class doesn't have any leading comments.
Because Black only inserts the new line when there's no leading comment? This feels a bit strange to me.
konstin
approved these changes
Aug 1, 2023
17f5446 to
5cef5a1
Compare
This file contains hidden or 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
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
This PR ensures that if a function or class is the first statement in a nested suite that isn't a function or class body, we insert a leading newline.
For example, given:
We want to preserve the newline, whereas today, we remove it.
Note that this only applies when the function or class doesn't have any leading comments.
Closes #6066.