Closed Keou0007 closed 4 years ago
This is by design, please see https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=E203#slices
Also a duplicate of #1541, #1448, #1437, #1413, #1343, #1332, #1323, #1029, #889, #785, #565, #544, #492, #403, #354, #350, #311, #279, #264, and #227...
contemplating why I decided to become a triager for Black
Anyway, please disable flake8's E203
as it is not PEP 8 compliant.
This is one of the places I ended up trying to figure this out for myself. So, for future travelers, at least as the time of this writing, here is how you disable E203 in PyCharm (2021.1.3):
This is by design, please see https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=E203#slices
That link was broken for me, this link works: https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html?highlight=E203#slices
I have a simple one liner that replaces the characters at the beginning of a string with a different (shorter) string. To achieve this I do a slice of the second string using a
len
call on the first string.black incorrectly adds a space into the slice, like so
PyCharm then highlights this as incorrect (PEP8: E203 whitespace before ':').
I'm using blackd server, version 20.8b1.