Increase max allowed value of line-length setting#24962
Conversation
|
MichaReiser
left a comment
There was a problem hiding this comment.
I'm fine with this change in principle because I don't see a strong argument why we shoud allow 320 but not 360.
Having said that, I can't recommend using the formatter with very large line length values because it will start flattening expressions. For example, it will format comprehensions on a single line if it fits into the configured line length. A comprehension longer than 320 characters is probably very unreadable at that point.
We'll also need to update https://github.com/astral-sh/ruff/blob/573796806d74267720b8b931174bcfdb3c0e32a1/crates/ruff_workspace/src/options.rs#L442
line-length setting
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Micha Reiser <micha@reiser.io>
|
Honestly this is my first real exposure to rust so I didn't know about the possibility of your change recs. Thanks!
Just like the ability to set your line lengths at all - leave it up to the coder's discretion :) They should already be aware of the effect of the setting, and understand how to choose when to prevent roll ups (nofmt/comment inside the comprehension, or no trailing comma for list/dict/&c). Anyone who's adjusted this setting already should have experienced the effects, regardless of the current ceiling.
Oops, got 'em! Thanks |
line-length settingline-length setting
* main: (63 commits) Update uraimo/run-on-arch-action action to v3.1.0 (#25011) Update dependency astral-sh/uv to v0.11.10 (#25002) Update prek dependencies (#25003) Update taiki-e/install-action action to v2.75.25 (#25007) Update Rust crate mimalloc to v0.1.50 (#25006) Update Rust crate libc to v0.2.186 (#25005) Update maturin to v1.13.1 (#25009) Update CodSpeedHQ/action action to v4.15.0 (#25008) Update Rust crate jiff to v0.2.24 (#25004) Increase max value of `line-length` setting (#24962) [ty] Fix the Pyodide assets deployment in the ty playground. (#24994) [ty] Selectively promote a union of homogeneous fixed-length tuples to a single variadic tuple. (#24705) [ty] Cache results in desperate module resolution (#24977) [ty] implement proper handling of recursive types in `CycleDetector` (#24773) [ty] Skip parameter accumulation for object variadics (#24976) Add missing rust related files when detecting changes in CI (#24971) [ty] Expand support for narrowing within walruses (#24968) [ty] Fix missing visitor guard in `Callable` branch (#24964) [ty] Allow reference finding in stringified annotations (#24956) [ty] Unpack Union of TypedDict in various sites (#24958) ...
Summary
This moves the arbitrary line-length upper limit of 320 to the declared u16 type max of 65535, better allowing coders who have editors capable of line-wrapping to denote when they want lines to be forcibly broken up with trailing commas where applicable.
Test Plan
Compiled, and run against scripts reformatted by the 320 limit. It correctly flattened the previously exploded lists and functions when the trailing comma was removed.
Applicable issues:
Closes #24547
#8106