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

Add automatic formatting via pre-commit hooks #179

Merged
merged 2 commits into from
Apr 19, 2024
Merged

Add automatic formatting via pre-commit hooks #179

merged 2 commits into from
Apr 19, 2024

Conversation

dbittman
Copy link
Contributor

@dbittman dbittman commented Apr 18, 2024

This PR is the first in a set that will add automatic formatting via pre-commit hooks and CI. Formatting is done by rustfmt, and is controlled by .rustfmt.toml.

I plan to apply the formatting changes that rustfmt wants in a separate PR, so as to limit all formatting changes to a single PR. Once the code is reformatted according to the rustfmt config we decide on, I'll update documentation to describe how to setup the pre-commit hook when contributing.

Starting this PR now so any bikeshedding discussion for rustfmt can be contained.

@dbittman dbittman added the enhancement New feature or request label Apr 18, 2024
@dbittman dbittman self-assigned this Apr 18, 2024
@dbittman dbittman requested a review from gvnn3 as a code owner April 18, 2024 19:18
Copy link
Contributor

@PandaZ3D PandaZ3D left a comment

Choose a reason for hiding this comment

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

Just one minor thing

newline_style = "Unix"
comment_width = 100
format_code_in_doc_comments = true
imports_granularity = "Crate"
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@PandaZ3D
Copy link
Contributor

What version of rustfmt is going to be used? Does this matter?

@dbittman
Copy link
Contributor Author

What version of rustfmt is going to be used? Does this matter?

I believe the rust-toolchain.toml file will clamp it to a specific nightly, like the bootstrap for xtask does. I don't think it's a huge deal.

@dbittman dbittman requested a review from PandaZ3D April 19, 2024 19:06
Copy link
Contributor

@PandaZ3D PandaZ3D left a comment

Choose a reason for hiding this comment

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

LGTM

@dbittman dbittman merged commit 79f81e4 into main Apr 19, 2024
1 check passed
@dbittman dbittman deleted the dbittman-fmt branch April 19, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants