Created
December 4, 2022 09:57
-
-
Save Nejat/9ad815f46596ddc8b0f0c12916d1af55 to your computer and use it in GitHub Desktop.
git pre-commit hook for rust projects
This file contains hidden or 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
#!/bin/sh | |
set -eu | |
# if ! cargo fmt -- --check | |
# then | |
# echo "check/fix fmt issues ..." | |
# exit -1 | |
# fi | |
if ! cargo clippy --all-targets --release -- -D warnings | |
then | |
echo "check/fix clippy issues ..." | |
exit 1 | |
fi | |
if ! cargo test --all --release | |
then | |
echo "check/fix failed test issues .." | |
exit 2 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment