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
Given a code line like the following, Ruff and Black both don't break the line, even it would be possible (and make it more readable IMHO). Black kinda tries to shorten the line a bit, but it would still be too long for the given limit.
This happens for example when extracting data from deeply object data structure.
# Input:foo=self.some_very.nested.data.which.is_really.really.deep_into_a_data_structure.far.beyond.line_length_limit# Black 23.12.1:foo= (
self.some_very.nested.data.which.is_really.really.deep_into_a_data_structure.far.beyond.line_length_limit
)
# Ruff 0.2.1foo=self.some_very.nested.data.which.is_really.really.deep_into_a_data_structure.far.beyond.line_length_limit
What I would like to see is breaking the property chain into multiple lines, something like this:
# Desired output:foo= (
self
.some_very
.nested
.data
.which
.is_really
.really
.deep_into_a_data_structure
.far
.beyond
.line_length_limit
)
# Alternative desired output (less readable, but also less wasted lines)foo= (
self.some_very.nested.data.which.is_really.really
.deep_into_a_data_structure.far.beyond
.line_length_limit
)
Thanks for opening this issue. We'll need to look at this holistically to ensure the formatting is consistent. E.g. how should attributes be broken in binary expressions? Should this style only apply in assignment positions or also in clause headers?
Given a code line like the following, Ruff and Black both don't break the line, even it would be possible (and make it more readable IMHO). Black kinda tries to shorten the line a bit, but it would still be too long for the given limit.
This happens for example when extracting data from deeply object data structure.
What I would like to see is breaking the property chain into multiple lines, something like this:
Note: This is closely related to #8598, thanks to Micha in Discord for the pointer.
The text was updated successfully, but these errors were encountered: