-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Disable ruff's COM812 #3144
base: main
Are you sure you want to change the base?
Disable ruff's COM812 #3144
Conversation
I thought that #3044 was specifically for enabling this check, cannot say I support disabling it. I have noticed that some changes require multiple pre-commit runs as well, and while slightly annoying at times I don't think it merits disabling this rule entirely. |
I wasn't sure if there's other lints in that. But the alternatives are:
|
Now, if the rules created an edit loop that didn't resolve after a few iterations, then I might be for this change, but as is I think the commas apply in a way that makes the code a bit more readable, especially in cases with functions with several arguments. |
I'm not sure the alternative (reorder checks) works. We could duplicate the black check. This is because it seems ruff is whitespace sensitive. So take for instance this: nested_array = [
[
1,
2,
3,
]
] Under nested_array = [[
1,
2,
3,
]] Whereas
I'll change this to duplicating the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3144 +/- ##
=======================================
Coverage 99.62% 99.62%
=======================================
Files 122 122
Lines 18400 18402 +2
Branches 1223 1223
=======================================
+ Hits 18331 18333 +2
Misses 47 47
Partials 22 22 |
I personally prefer disabling COM812 over duplicating black. COM812 is perhaps nice, and ofc no reason to undo the changes in the PR, but I don't think it's worth having to duplicate black.
from the link:
So I think because you have a trailing comma on the If we can't make both ruff & black happy simultaneously I strongly think COM812 should be disabled, as we're otherwise gonna introduce headaches for LSP and/or IDE users that might be raising errors and/or autoformatting code. |
Ruff's documentation recommends this be disabled with their formatter. I assume that advice holds for
black
too. The other rule they recommend disabling isISC001
which I don't think black has trouble with.I don't see a better way to keep this up to date, but the way I noticed this probably works. I was making changes and pre-commit was making me run git commit thrice, as the
ruff
autofixes didn't pass the next round ofblack
. The sequence was git commit:black
->ruff
(because ordering), then git commit:black
, then git commit: it actually worked.