-
Notifications
You must be signed in to change notification settings - Fork 31
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
Ignore C812 when all items are on one line #58
Comments
I agree! Especially, https://github.com/psf/black formats the code like this for "short" lists of function parameters. |
Strong +1 on this :) |
Serious question: if you like that format, without the comma, and are already using |
Not for me, but for other coders (especially newcomers) |
I personally use black but we don't enforce it's use by all developers. The linting rules are our standard. |
If this issue is still being considered, I'd like to add this useful SO discussion to the debate in favour of this issue. In particular, this bit:
|
@gorrog thanks for adding that, it's interesting to note the differences between this package and PEP8 as described in that post. While I think generally PEP8 is/was a good starting point for formatting Python, a lot has been learned over the years since it was created. As a result, I think it is reasonable that we allow linters and other tools to implement nuanced improvements over the guidelines it sets out. Additionally: PEP8 already existed when this project was created, so I don't find the mismatch between it and PEP8 a compelling argument to change the direction it takes. Currently my personal preference in this situation is that this linter force the presence of a comma. This is substantially because it forces black to wrap the function to the longer format, which then improves consistency & reduces diff noise1. (back to speaking as a maintainer) I'm not really sure I understand the desire to use this linter alongside black without this rule, though I suspect I'm missing something about the cases described which makes it work for others. Here's my current understanding & reasoning -- please do let me know where I'm missing why a case is useful!
I'd love to know what I've missed/misunderstood here! I might be open to a PR which changed this case to being a separate error code (but not to remove it completely), as long as doing so didn't look like it would present too much maintenance burden (probably and wasn't too invasive into the rest of the code). We would likely also need to coordinate such a change with the Footnotes
|
I'd like to ignore the enforcement of a trailing comma where all items are on a single line that isn't the same line as the opening bracket. For example,
The text was updated successfully, but these errors were encountered: