Trailing own line comments before func or class#4921
Merged
MichaReiser merged 1 commit intomainfrom Jun 8, 2023
Merged
Conversation
This was referenced Jun 7, 2023
Member
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
59c3e35 to
48ce57f
Compare
Base automatically changed from
replace-verbatim-with-not-yet-implemented
to
main
June 7, 2023 12:57
bb0517f to
2448287
Compare
Contributor
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinuxWindows |
2448287 to
5a9709d
Compare
Merged
5a9709d to
894b045
Compare
894b045 to
f5240f7
Compare
bab81d7 to
f42af55
Compare
f5240f7 to
1b58a53
Compare
konstin
approved these changes
Jun 8, 2023
1b58a53 to
6a13e21
Compare
auto-merge was automatically disabled
June 8, 2023 12:44
Pull request was closed
This was referenced Jun 8, 2023
Merged
konstin
pushed a commit
that referenced
this pull request
Jun 13, 2023
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 adds special handling for own line comments between a statement and a function or class definition on the module level.
By default, the
# This should be stick to the statement abovewould become a leading commentof the
classAND theSuiteformatting separates the comment by two empty lines from theprevious statement, so that the result becomes:
Which is not what we want. The work around is to make the
# This should be stick to the statement abovea trailing comment of the previous statement.
Test Plan
You can see that this case is now correctly covered in the Black
comments9.pytest case