mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 08:53:56 -05:00
added git pre-commit hook
This commit is contained in:
parent
c4e6bcb664
commit
fa18237a57
2 changed files with 17 additions and 0 deletions
16
.githooks/pre-commit
Executable file
16
.githooks/pre-commit
Executable 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
|
||||||
|
|
@ -25,6 +25,7 @@ _: {
|
||||||
autoSetupRemote = true;
|
autoSetupRemote = true;
|
||||||
};
|
};
|
||||||
advice.addIgnoredFile = false;
|
advice.addIgnoredFile = false;
|
||||||
|
core.hooksPath = ".githooks";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue