-
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 and flake8 can't agree on line length limit #1314
Comments
I've recently been trying to use black in stuff I do, and i found that setting flake8 to --max-line-length=~95-100 lets you live in relative peace. Black will sometimes overflow, but not by much. If it does overflow by a lot, it might be because it cannot split string (yet). So you will have to fix that manually - and flake will let you know. |
How do you format this part manually to satisfy line length requirement? |
I have found the easiest way is to disable the relevant Flake8 errors and just let Black handle them - you can use |
I'd be okay with that as a resolution if that were the recommendation of the |
Please keep it that way, not breaking strings is a feature! Sometimes we all have strings which are not interesting at all to be read or changed. One can easily manually break the exceptionally interesting ones. If you are curious, e.g. encoders can have alphabets with hundreds of columns in a string. Error messages etc. Moreover, interpolation and line breaks together are a hell to edit and keep it formatted. |
I don't think anything in my example suggests to break string lengths. The longest string in that block is 30 chars. |
Duplicate of #413. The sample code is:
|
@JelleZijlstra I don't see the similarity of #413 and #1314 . The latter is for flake8 and black to get along but the first seems to be for broken formatting. |
The reason they don't "get along" is that Black doesn't split a line that is too long, so the fix is to make it so Black does split the line, which is what #413 is about. If there's anything else that this issue would cover, I'm not seeing it. |
Given this code, flake8 (correctly) errors that the line is longer than the declared line length, which is 88 to match the expectation of black. If I correct the syntax to satisfy flake8, black starts to fail, such as in this commit.
Is there a way for black and flake8 to get along?
The text was updated successfully, but these errors were encountered: