diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100644 --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,15 @@ +#!/bin/sh + +# Run rustfmt check +cargo fmt -- --check +if [ $? -ne 0 ]; then + echo "rustfmt check failed. Run 'cargo fmt' to fix." + exit 1 +fi + +# Run clippy +cargo clippy --all-targets -- -D warnings +if [ $? -ne 0 ]; then + echo "clippy check failed. Fix the warnings above." + exit 1 +fi