-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: Don't move comments while splitting delimiters #4248
Merged
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
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Test failures and diff-shades crash are caused by bad_split3 = (
- "What if we have inline comments on " # First Comment
- "each line of a bad split? In that " # Second Comment
- "case, we should just leave it alone." # Third Comment
+ "What if we have inline comments on " # First Comment # Second Comment # Third Comment
+ "each line of a bad split? In that "
+ "case, we should just leave it alone."
) |
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
cobaltt7
changed the title
fix: Don't merge comments while splitting delimiters
fix: Don't move comments while splitting delimiters
Feb 27, 2024
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
I have extracted the unrelated refactorings to #4257 for ease of review. That needs to be merged before lint passes on this PR. |
JelleZijlstra
approved these changes
Mar 1, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
3 tasks
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.
Description
Resolves #4220. Black moved the + at the end of the line to the start of the next line, then unintentionally moved any comments as well. This could cause comments to be merged. To fix this, I stopped Black from moving any comments with the delimiter. It only crashed when merging
type: ignore
comments, but I think it makes sense to keep all comments on their original line instead of following the delimiter. This does not break the stability policy since already-Blackened code will not change.Depends on #4257 for lint to succeed.
Checklist - did you ...
CHANGES.md
if necessary?