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 pre-commit hook to format Rust #383

Open
caugner opened this issue Oct 17, 2023 · 0 comments
Open

Add pre-commit hook to format Rust #383

caugner opened this issue Oct 17, 2023 · 0 comments
Labels
chore A routine task. effort: medium This task is a medium effort. idle Issues and pull requests with no activity for three months. p3 We don't have visibility when this will be addressed.

Comments

@caugner
Copy link
Contributor

caugner commented Oct 17, 2023

Background: We use Rustfmt to enforce consistently formatted Rust code. The tool is run as part of the build-and-test workflow and will prevent merging a PR with Rust code that isn’t formatted.

Problem: When we commit changes to Rumba, the changes aren’t automatically formatted, so engineers have to run cargo fmt --all manually to ensure their code is properly formatted. If we push code that isn't formatted, then the GitHub workflow will fail on the GitHub PR. This means the author has to check out the code again, format it, commit and push again. In the lifetime of a PR, this can happen multiple times, causing unnecessary overhead and reducing developer efficiency.

Solution: Configure a Git Hook (like we already use in Yari) to automatically format all committed code in the pre-commit hook.

(Moved from https://mozilla-hub.atlassian.net/browse/MP-362.)

@caugner caugner added chore A routine task. effort: medium This task is a medium effort. p3 We don't have visibility when this will be addressed. labels Oct 17, 2023
@github-actions github-actions bot added the idle Issues and pull requests with no activity for three months. label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore A routine task. effort: medium This task is a medium effort. idle Issues and pull requests with no activity for three months. p3 We don't have visibility when this will be addressed.
Projects
None yet
Development

No branches or pull requests

1 participant