Skip to content

Commit

Permalink
add post-commit hook for "cargo fmt / check"
Browse files Browse the repository at this point in the history
  • Loading branch information
yshavit authored Jun 9, 2024
1 parent bad5b47 commit 6ba0b8e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions githooks/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail

if ! cargo fmt --check &>/dev/null ; then
echo >&2 "WARNING: Need to run cargo fmt"
fi
if ( 2>&1 cargo check --color never || ( echo error | true ) ) | grep -q -e warning -e error ; then
echo >&2 "WARNING: Need to run cargo fix"
fi

0 comments on commit 6ba0b8e

Please sign in to comment.