Add pre-commit hook to format Rust #383
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.
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.)
The text was updated successfully, but these errors were encountered: