-
Notifications
You must be signed in to change notification settings - Fork 7
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
Extend to trailing/leading space on split strings [Enhancement] #12
Comments
@peterjc it looks like that issue was closed, but I'm not sure of the resolution |
From the examples on psf/black#1132 it looks like when black breaks strings, it will use a leading space (not a trailing space). But we should confirm that in testing before making that a default here too. |
Confirmed, black v22.1.0 with print(
"She's the one for me, She's my ecstasy, She's the one I need. She's one in a"
" million, She's once in a lifetime, She made me discover one of the stars"
" above us."
) However, it does not appear to auto-break at explicit sys.exit(
"UNEXPECTED ERROR: %s\nPlease report via"
" https://github.com/example/example/issues\nThank you!"
) |
Sticking to leading/trailing spaces, here's what black v22.1.0
So leaving aside other white space for now, |
Thanks for taking on the idea in #6, here's another idea which is related but even further from your original plugin scope. Consider a long string literal like this:
The above would trigger E501 for a long line. Leaving aside line length settings, the question here is do you put the trailing space at the beginning or the end of the line?
You might like trailing spaces:
or in black style,
Alternatively, you might like leading spaces (visually obvious when they are missing):
Or in black style,
This plugin could define a new violation code for this, maybe:
If black decides on a preference, you would perhaps only need one of these codes (see discussion on psf/black#182 and linked issues).
If anyone strongly prefers the opposite, it might be useful to have both defined and one ignored by default (the solution used with contradictory checks used in other flake8 plugins).
Similarly, I often see multi-line strings with new lines in them, and here my preference is to have the
\n
at the end of the line:versus:
versus:
The text was updated successfully, but these errors were encountered: