Format rule to keep together }, { for list of objects
darowny opened this issue · comments
Michał Darowny commented
Is there a setting or a rule that will keep this style of formatting ? I mean keeping }, {
together and then hugging }]
at the end?
trans = [{
'first': Stuff,
'second': Other,
'third': Blah,
'fourth': Sth
}, {
'first': Stuff,
'second': Other,
'third': Blah,
'fourth': Sth
}, {
'first': Stuff,
'second': Other,
'third': Blah,
'fourth': Sth
}]
I tried 0.3.4 and 0.4.3 ruff for this, with enabled preview, shouldn't it keep hugging braces and brackets ?
Related discussion I think
Micha Reiser commented
Hi @darowny
No, there's no such formatter setting.
The hugging preview style only applies if the array (or dict or set) is the only argument in a function call or the only content of a prenthesized expression
trans = call([
{
"first": Stuff,
"second": Other,
"third": Blah,
"third": Blah,
}
])
trans = a + ([
{
"first": Stuff,
"second": Other,
"third": Blah,
"third": Blah,
}
])