-
-
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
Allow parenthesized implicitly concatenated strings inside calls, to be more compatible with Black. #8590
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8590 +/- ##
=======================================
Coverage 95.84% 95.84%
=======================================
Files 173 173
Lines 18466 18492 +26
=======================================
+ Hits 17698 17724 +26
Misses 768 768
|
This comment has been minimized.
This comment has been minimized.
@yilei I guess nobody has time to review this yet, but as a start could you look at the coverage issue? You seem to be missing a line. |
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.
Sorry to react only after I read the functional tests I was not understanding things properly before. I think I thought and started to create test case about this earlier but I lost the change when my hard drive crashed because I can't find the branch anymore. What I wanted to do at some point was to check problem on a single line even inside multiline:
print(
"Lorem ipsum dolor sit amet, ""consectetur adipiscing elit," # [implicit-str-concat] (notice the "" before 'consectetur')
"Lorem ipsum dolor sit amet, consectetur adipiscing elit,"
" sed do eiusmod tempor incididunt ut labore et dolore "
"magna aliqua. Ut enim ad minim veniam, quis nostrud "
"exercitation ullamco laboris nisi ut aliquip ex ea "
)
I.e. if the string concat happens on a single line then raise implicit-str-concat
else do not raise. But the approach from the checker was to be changed completely for that to work (use token I think?). Let me know what you think :)
@DanielNoord The coverage issue should be addressed. The missed line was actually dead code that can't be reached. @Pierre-Sassoulas Thanks for taking a look. If they are on the same line, |
This comment has been minimized.
This comment has been minimized.
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.
LGTM, thank you !
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.
Thanks! I think this is ready to merge. I found some minor typos.
Finally, it would be worth removing the reference to this PR added in #8649 and just show beneath the example there how to rewrite it correctly (as black will do it, soon).
e2ee5a2
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit a315e0c |
Type of Changes
Description
For discussion in #8552.
Closes #8552
For reference, here is Black's preview style results with relevant usages: playground
Alternatively, we could add another option (default to keep the existing behavior) to silence parenthesized
implicit-str-concat
.