-
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
Black causes W1404 Implicit string concatenation found in assignment (implicit-str-concat) #1837
Comments
I believe the |
Excellent. Thanks! |
- Switched from yapf to black - Reconfigure isort for black - Resolve black/pylint idiosyncrasies Note: I used `--experimental-string-processing` because black was producing "implicit string concatenation", similar to what described here: psf/black#1837. While currently this feature is experimental, it will be enabled by default: psf/black#2188. After running black with the new string processing so that the generated code merges these `"hello" " world"` strings concatenations, then I removed `--experimental-string-processing` for stability, and regenerated the code again. To the reviewer: don't even try to open "Files Changed" tab 😄 It's better to review commit-by-commit, and ignore `run black and isort`.
- Switched from yapf to black - Reconfigure isort for black - Resolve black/pylint idiosyncrasies Note: I used `--experimental-string-processing` because black was producing "implicit string concatenation", similar to what described here: psf/black#1837. While currently this feature is experimental, it will be enabled by default: psf/black#2188. After running black with the new string processing so that the generated code merges these `"hello" " world"` strings concatenations, then I removed `--experimental-string-processing` for stability, and regenerated the code again. To the reviewer: don't even try to open "Files Changed" tab 😄 It's better to review commit-by-commit, and ignore `run black and isort`.
We're still seeing this in v23.3.0. The |
It is not yet enabled by default; it's still part of |
I have an f-string that looks like
which reports the violations |
That's intentional. If you like this changed, please upvote/comment here: #2553. |
- Switched from yapf to black - Reconfigure isort for black - Resolve black/pylint idiosyncrasies Note: I used `--experimental-string-processing` because black was producing "implicit string concatenation", similar to what described here: psf/black#1837. While currently this feature is experimental, it will be enabled by default: psf/black#2188. After running black with the new string processing so that the generated code merges these `"hello" " world"` strings concatenations, then I removed `--experimental-string-processing` for stability, and regenerated the code again. To the reviewer: don't even try to open "Files Changed" tab 😄 It's better to review commit-by-commit, and ignore `run black and isort`.
Describe the bug
When Black decides a multiline string can be put to single line, it leaves the concatenation in place rather than merging them to a single string. This is considered a bug pattern by Pylint and does seem to be a bug rather than a feature from Black.
To Reproduce Steps to reproduce the behavior:
Having code something like this:
will, when line length allows, be pulled by Black to:
rather than a single string.
Expected behavior
In the above situation I would have expected the result to be:
instead of single-line implicit concatenation that is by default flagged by Pylint (W1404)
**Environment **
Does this bug also happen on master?
Yes
The text was updated successfully, but these errors were encountered: