If a dictionary has a key value which doesn't fit, black reformats it incorrectly. For example
a = {
'averylongkeywhichdoesntfitin40charsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx':
'averylongvaluewhichwereallytostretch'
}
is reformatted to:
a = {'averylongkeywhichdoesntfitin40charsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 'averylongvaluewhichwereallytostretch'}
I believe the first version is correct. The second one is certainly not. Possibly related to #808.
Operating system: OS X
Python version: 3.7.2
Black version: 19.3b0
Does also happen on master: yes
I'm having the same issue here. This is problematic when black is combined with flake8 in CI, since black forces one line key:item pairs which forces it over the line limit.
I am having the same problem, if the value is too long, black is not breaking it to new lines
Did this issue ever get resolved? I'm running into it as well.
I recently realized this is already reported. Let's move the conversation over there
Dupe of #620
@zsol I've commented on #620, but this looks like two separate issues (my issue is very close to @therve original issue).
a = {
key: value
}
...black does not split key: value even if the line is too long (see https://github.com/psf/black/issues/620#issuecomment-481880006 and https://github.com/psf/black/issues/620#issuecomment-559415991).
Most helpful comment
I'm having the same issue here. This is problematic when
blackis combined withflake8in CI, sinceblackforces one line key:item pairs which forces it over the line limit.