You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing a case where black is expanding an assignment but ruff is not - even re-writing the black formatted result.
To keep it concise, this example uses an ultra-short line-length of 14:
Input
long_variable_name = 1234
Black:
long_variable_name = (
1234
)
Ruff:
long_variable_name = 1234
This seems to occur only when the name of the variable assigned to, is longer than line-length (so expanding the line won't bring it within the allowed length).
I can't find this in the documented deviations or other issues at present, and this doesn't seem to be a duplicate of another issue.
The text was updated successfully, but these errors were encountered:
Yes, I can confirm that #8940 would fix the deviation. The problem is, that the PR has a few regressions around call expression formatting, which is why the PR was abandoned. So fixing this requires some more work and is also something that I don't think we can fix outside of a new formatter style guide as it would change how already formatted code gets formatted.
But we should have a second look at this when we work on the next formatter style guide to see if we can match Black more closely.
The main issue here is that Ruff doesn't parenthesize the expression if the ( doesn't fit inside the line length, whereas Black only avoids the parentheses if the content doesn't fit into the line length.
I'm seeing a case where black is expanding an assignment but ruff is not - even re-writing the black formatted result.
To keep it concise, this example uses an ultra-short line-length of 14:
Input
Black:
Ruff:
This seems to occur only when the name of the variable assigned to, is longer than line-length (so expanding the line won't bring it within the allowed length).
I can't find this in the documented deviations or other issues at present, and this doesn't seem to be a duplicate of another issue.
The text was updated successfully, but these errors were encountered: