added git pre-commit hook

This commit is contained in:
Gerg-L 2023-07-28 20:03:28 -04:00
parent c4e6bcb664
commit fa18237a57
2 changed files with 17 additions and 0 deletions

16
.githooks/pre-commit Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
STAGED="$(git diff --name-only --cached | grep "**.nix" | tr '\n' ' ')"
if [ -z "$STAGED" ]; then
exit 0
fi
for i in $STAGED; do
statix fix -- "$i"
done
deadnix -qe $STAGED
alejandra -q $STAGED
git add $STAGED

View file

@ -25,6 +25,7 @@ _: {
autoSetupRemote = true;
};
advice.addIgnoredFile = false;
core.hooksPath = ".githooks";
};
};
};