-
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
Trailing comma not removed in type annotation #1756
Comments
This no longer reproduces exactly because of the magic trailing comma, but you still get the |
Still reproduces on current main with |
This would be great to fix: we are doing the The mechanical patching part for context is adding suppressions for |
got it, yes that's kind of an old bug lol. I will check and report back. |
Yes, all fixed. I think we should close this issue. |
Describe the bug
By running black with different line lengths, I can produce inconsistent results that ultimately fail in flake8 (and look strange).
To Reproduce
Consider this relatively silly example (let's call it
test.py
), with a line of length 81:Both black and flake8 are happy with this:
All is good. Now, run black with
-l 70
, then without a line lengthNow the file looks different from the starting point:
Moreover, flake8 doesn't like the trailing comma:
By ignoring the change of line length in the example above, you can also choose to think of this of an example where black (with no line length specification) causes issues with flake8; I'm not sure if this is a flake8 bug (a la this one) or a black issue. Even then, it seems like
black test.py
should be equivalent toblack -l 70 test.py && black -l test.py
.Environment (please complete the following information):
Does this bug also happen on master?
I tried https://black.now.sh/?version=master which fails to convert the intermediate result back to the one-liner when given a line-length of 88. I'm not sure if this is just a separate bug.
The text was updated successfully, but these errors were encountered: