-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a simple
pre-commit
git hook to verify each package's formatting
- Loading branch information
1 parent
4d036c3
commit a542735
Showing
2 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit immediately on first non-zero status from a command in the script. | ||
set -o errexit | ||
|
||
# Ensure all tools being used are available. | ||
command -v "cargo" >/dev/null 2>&1 || { echo >&2 "The 'cargo' command is not installed, exiting"; exit 1; } | ||
command -v "rustfmt" >/dev/null 2>&1 || { echo >&2 "The 'rustfmt' command is not installed, exiting"; exit 1; } | ||
|
||
# Check the formatting of all Rust code for every package. | ||
for package in "esp"*/; do | ||
# Check package is correctly formatted. | ||
cargo fmt --all --manifest-path "${package}Cargo.toml" -- --check | ||
done |