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

Update configs to use Ruff format instead of Black #2389

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Oct 11, 2024

Follow-up to #2340 (closes #2340 if this is merged first)

Ruff format's style is based on Black's, but with a handful of improvements. It also runs much faster on the entire repo, which is nice locally. There's an added advantage of being mostly Python-version agnostic (at least we don't need to run it in a Python environment, so it won't drop support for older versions faster than we do, unlike Black). Since we already use Ruff's linter, this doesn't add any new tool (and actually removes one) nor configuration file.

First commit are manual changes. Second commit is only running ruff format

Comment on lines 9 to +12
max_line_length = 120 # Same as .clang-format

[*.py]
max_line_length = 88 # Same as Black
max_line_length = 88 # Same as Ruff's default
Copy link
Collaborator Author

@Avasam Avasam Oct 11, 2024

Choose a reason for hiding this comment

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

If you'd like to have a consistent line-length across all files. I can change it in .clang-format and/or ruff.toml to your preference in an follow-up PR.

Copy link
Owner

Choose a reason for hiding this comment

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

If you'd like to have a consistent line-length across all files.

God no - that's something I wish these linting tools cared less about :)

@Avasam Avasam mentioned this pull request Oct 12, 2024
@Avasam Avasam added the dependencies Pull requests that update a dependency file label Oct 12, 2024
Copy link
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

Thanks! Could you please arrange for the auto-formatted stuff to land in its own commit then add that commit to https://github.com/mhammond/pywin32/blob/main/.git-blame-ignore-revs

Comment on lines 9 to +12
max_line_length = 120 # Same as .clang-format

[*.py]
max_line_length = 88 # Same as Black
max_line_length = 88 # Same as Ruff's default
Copy link
Owner

Choose a reason for hiding this comment

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

If you'd like to have a consistent line-length across all files.

God no - that's something I wish these linting tools cared less about :)

@Avasam
Copy link
Collaborator Author

Avasam commented Oct 14, 2024

Thanks! Could you please arrange for the auto-formatted stuff to land in its own commit then add that commit to main/.git-blame-ignore-revs

Done ! Ready to Rebase-merge.

@Avasam Avasam merged commit 5a46a21 into mhammond:main Oct 18, 2024
28 checks passed
@Avasam Avasam deleted the ruff-format branch October 18, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants