Skip to content

Commit

Permalink
fixup! feat: add fmt githook
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Dec 30, 2023
1 parent 50c4226 commit de2fdb6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions contrib/pre-commit
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

# Run make fmt before committing
# Run make fmt
make fmt

# If make fmt fails, prevent the commit
if [ $? -ne 0 ]; then
echo "Error: make fmt failed. Please fix formatting issues before committing."
exit 1
fi
FMTCMD="${CARGO_FMT_CMD:cargo fmt -- --check}"

# Redirect output to stderr.
exec 1>&2

unset RUST_LOG
set -e

# check everything else
$FMTCMD

0 comments on commit de2fdb6

Please sign in to comment.