-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ruff line-length in format_dev #6870
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
PR Check ResultsBenchmarkLinux
Windows
|
|
||
let settings = resolver.resolve(&path, pyproject_config); | ||
// That's a bad way of doing this but it's not worth doing something better for format_dev | ||
if settings.line_length != LineLength::default() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because you're trying to see if it's not the default? Why can't we just use settings.line_length
? Because it will be wrong for projects in the formatter CI that use Black but not Ruff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this only exists to have a (dummy) usage for the line length without breaking the formatter ecosystem checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should Settings.line_length
be an Option<LineLength>
if that's something we want to distinguish?
340ebe3
to
87ed83b
Compare
87ed83b
to
716248b
Compare
Please give this another look, this now only changes what's really needed for |
crates/ruff_dev/src/format_dev.rs
Outdated
let line_width = LineWidth::try_from(settings.line_length.value()) | ||
.expect("Configured line length is too large for the formatter"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i still don't like this divergence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do LineWidth::from(NonZeroU16::from(line_length)))
crates/ruff_dev/src/format_dev.rs
Outdated
let line_width = LineWidth::try_from(settings.line_length.value()) | ||
.expect("Configured line length is too large for the formatter"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do LineWidth::from(NonZeroU16::from(line_length)))
Summary Use the
[ruff]
config line length setting in format_dev. This aligns it withruff format
(originally, this was the prototype forruff format
, but nowruff format
works and we instead need to keepformat_dev
consistent).