Open trim21 opened 3 months ago
I think this is related; https://github.com/psf/black/pull/3964#issuecomment-1783318353 And this in black is the part which may be missing in ruff: https://github.com/psf/black/pull/3992
title of this issue is not very accurate and I don't know how black call this feature...
I think it is called hug_parens_with_braces_and_square_brackets
:
https://github.com/astral-sh/ruff/discussions/9945#discussioncomment-8439722
I think it is called
hug_parens_with_braces_and_square_brackets
: #9945 (comment)
thanks
It seems like we don't consider generator to be huggable:
I'm not sure if it's intentional or not but Micha might be able to provide more context on this once he's back from his PTO.
Although it does seem that a tuple expression is huggable, so I'd say that the generator should probably be as well.
This is not listed in "Known Deviations from Black", is this unexpected behavior?
We don't track differences for preview styles because both Black's and Ruff's preview styles are in flux, making it difficult to track the differences over time.
I'm not sure if it's intentional or not but Micha might be able to provide more context on this once he's back from his PTO.
I don't think this is intentional. The only thing we need to be mindful of is that generator parentheses in call expressions are optional. Meaning, we should only hug if the generator already has parentheses (the logic must be in sync with the parentheses logic in FormatExprGenerator
)
I'm using ruff format with
--preview
enable, and it generate different output in this case.ruff:
black:
This is not listed in "Known Deviations from Black", is this unexpected behavoir?
pyproject.toml