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

Use ufmt for code formatting and import sorting #2262

Merged
merged 7 commits into from
Feb 1, 2023
Merged

Use ufmt for code formatting and import sorting #2262

merged 7 commits into from
Feb 1, 2023

Conversation

Balandat
Copy link
Collaborator

@Balandat Balandat commented Jan 31, 2023

ufmt (https://ufmt.omnilib.dev/en/stable/) is a tool that combines code formatting (via black) and sorting (via usort). It's been working great for us for other projects. This PR enables the ufmt style in GitHub actions and pre-commit.

µfmt formats files in-memory, first with µsort and then with black, before writing any changes back to disk. This enables a combined, atomic step in CI/CD workflows for checking or formatting files, without any chance of conflict or intermediate changes between the import sorter and the code formatter.

@Balandat Balandat requested a review from gpleiss January 31, 2023 06:00
@gpleiss gpleiss merged commit 2e77f12 into master Feb 1, 2023
@gpleiss gpleiss deleted the ufmt branch February 1, 2023 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants