Skip to content
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

Unify line size settings between ruff and the formatter #6873

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

konstin
Copy link
Member

@konstin konstin commented Aug 25, 2023

Summary Previuosly, there had been LineLength in ruff and LineWidth in the formatter. LineLength was a lenient usize wrapper, while LineWidth was a strict u16. With the formatter moving into the ruff cli, we need to unify the two types. This PR makes both crates share a new LineLength type based on the previous ruff formatter type. It currently lives in ruff_python_trivia but i'm happy to move it wherever.

This is technically a breaking change because the line limit afterwards has a limit of 320 that it didn't have before.

Test Plan No functional changes.

@konstin
Copy link
Member Author

konstin commented Aug 25, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@konstin konstin added formatter Related to the formatter breaking Breaking API change labels Aug 25, 2023
@github-actions

This comment was marked as outdated.

@konstin konstin force-pushed the merge-line-sizings branch 3 times, most recently from b2235f9 to bb6991b Compare August 25, 2023 15:14
@konstin konstin marked this pull request as ready for review August 25, 2023 15:22
@@ -140,7 +140,8 @@ def main(*, name: str, prefix: str, code: str, linter: str) -> None:
variant = pascal_case(linter)
rule = f"""rules::{linter.split(" ")[0]}::rules::{name}"""
lines.append(
" " * 8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's the deviation from black we're introducing, i'm using it to confirm that it actually formats

@MichaReiser MichaReiser self-assigned this Aug 25, 2023
Base automatically changed from ruff-format-a-project to main August 27, 2023 19:12
**Summary** Previuosly, there had been `LineLength` in ruff and `LineWidth` in the formatter. `LineLength` was a lenient usize wrapper, while `LineWidth` was a strict u16. With the formatter moving into the ruff cli, we need to unify the two types. This PR makes both crates share a new `LineLength` type based on the previous ruff formatter type. It currently lives in `ruff_python_trivia` but i'm happy to move it wherever.

This is technically a breaking change because the line limit afterwards has a limit of 320 that it didn't have before.

**Test Plan** No functional changes.
@MichaReiser MichaReiser changed the title Unify line size settings between ruff and the formatter Unify line size settings between ruff and the formatter Aug 28, 2023
@MichaReiser MichaReiser enabled auto-merge (squash) August 28, 2023 06:28
@MichaReiser MichaReiser merged commit e615870 into main Aug 28, 2023
16 checks passed
@MichaReiser MichaReiser deleted the merge-line-sizings branch August 28, 2023 06:44
zanieb added a commit that referenced this pull request Sep 15, 2023
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
Adds the maximum of 320 for the line-length setting to the JSON schema
for better integration with IDEs.

Related #6873

## Test Plan

<!-- How was it tested? -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API change formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants