-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 does not create pylint-compatible code #1127
Comments
Black is unlikely to change such a core aspect of its formatting style at this stage. I recommend that you turn off any formatting-related errors from linters if you run Black on your codebase. |
Is it possible to add a flag in the config to disable/change this behavior? |
Sorry, no. As explained in the README, Black is striving for a single codestyle with minimal configuration. |
If I understand correctly, Black has chosen to diverge from PEP8 on this point, because the latter emphasizes "... an extra level of indentation ..." for function arguments. While I naively prefer Black's choice to that in PEP8, I ask confirmation from those who've studied this more: do Black and PEP8 make different choices for indentation of function arguments? |
This breaks the Black's contract:
|
I want to be sure I understand. For our convenience, I identify def f1_(
arg1, ...
# four-space indent as Style A and def f1_(
arg1, ...
# eight-space indent as style B. When vianney-g writes, "This breaks the Black's contract", I think vianney-g is saying that:
I welcome any correction in my understanding. |
😢 |
Pylint error code: C0330 (bad-continuation; i.e. "Wrong hanging indentation before block")
Original code snippet
Examples in the current Black style
Note how the function parameters are on the same indentation level as the function body.
Desired style
It does this in various situations, but the core of the issue stays the same; The newer line ends up on the same indentation level as the function body
The text was updated successfully, but these errors were encountered: