Created
April 30, 2025 19:59
-
-
Save withzombies/cabb08f00377a4d6d7fbb0532f51e15f to your computer and use it in GitHub Desktop.
rust git recommit script
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/bash | |
# Check formatting | |
echo "Checking formatting with cargo fmt..." | |
if ! cargo fmt --all -- --check; then | |
echo "Error: Code is not formatted. Please run 'cargo fmt --all' before committing." | |
exit 1 | |
fi | |
# Run Clippy linter | |
echo "Running cargo clippy..." | |
if ! cargo clippy --all-targets --all-features -- -D warnings; then | |
echo "Error: Clippy found warnings or errors. Please fix them before committing." | |
exit 1 | |
fi | |
# Run tests | |
echo "Running tests with cargo test..." | |
if ! cargo test --all; then | |
echo "Error: Some tests failed. Please fix them before committing." | |
exit 1 | |
fi | |
echo "All checks passed. Proceeding with commit." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment