githooks: add pre-commit hook with dry `cargo fmt`

This commit is contained in:
Mikolaj Wielgus 2023-12-23 03:04:19 +00:00
parent 81e316397f
commit 4596ec6a7d
1 changed files with 11 additions and 0 deletions

11
.githooks/pre-commit Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
diff=$(cargo fmt -- --check)
result=$?
if [ ${result} -ne 0 ]; then
echo "There are some code formatting issues, run `cargo fmt` first."
exit 1
fi
exit 0