Is there a way to prevent folded lists which don't fit on one line from being put into a single new line? #14504
-
I don't know how to phrase the question in english, but this is what I'm talking about: def foo(a: int, b: int, c: int, d: int): Let's say the line length is 25 characters. Then this will be formatted as: def foo(
a: int, b: int, c: int, d: int
): This is what I want to prevent. Instead, if a "list of things" (arguments, list/set/dict literals, whatever) doesn't fit on the first line, then it should always be broken up into multiple lines with a final trailing comma: def foo(
a: int,
b: int,
c: int,
d: int,
): I know you can force this kind of formatting by adding the trailing comma... but if you forget to do this, then you get the folded formatting (which can be hard to read IMHO). Can I force ruff to always break these up w/o having to require the developer to manually add the final trailing comma by hand? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @lexicalunit Thanks for the examples. They made it very easy to understand what you're looking for :) No, there's currently no such configuration option. There's an open issue for this. You could try using COM812 in addition to the formatter. There |
Beta Was this translation helpful? Give feedback.
Hi @lexicalunit
Thanks for the examples. They made it very easy to understand what you're looking for :)
No, there's currently no such configuration option. There's an open issue for this. You could try using COM812 in addition to the formatter. There