mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:25:17 +00:00
Fix multiline lambda expression statement formating (#8466)
## Summary This PR fixes a bug in our formatter where a multiline lambda expression statement was formatted over multiple lines without adding parentheses. The PR "fixes" the problem by not splitting the lambda parameters if it is not parenthesized ## Test Plan Added test
This commit is contained in:
parent
75c9be099f
commit
e57bccd500
3 changed files with 95 additions and 3 deletions
|
@ -203,3 +203,28 @@ lambda: ( # comment
|
|||
y:
|
||||
z
|
||||
)
|
||||
|
||||
lambda self, araa, kkkwargs=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(*args, **kwargs), e=1, f=2, g=2: d
|
||||
|
||||
# Regression tests for https://github.com/astral-sh/ruff/issues/8179
|
||||
def a():
|
||||
return b(
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f=lambda self, *args, **kwargs: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
|
||||
*args, **kwargs
|
||||
),
|
||||
)
|
||||
|
||||
def a():
|
||||
return b(
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f=lambda self, araa, kkkwargs,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
args,kwargs,
|
||||
e=1, f=2, g=2: d,
|
||||
g = 10
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue