mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 15:02:07 -03:30
Break out the pre-commit hook into an explicit script
This means that - we don't have to be always updating the underlying .git/hooks/pre-commit file - updates to the logic will just work automatically - the logic of the black logic has been fixed so that AWX_IGNORE_BLACK=1 should work right now
This commit is contained in:
parent
e970620672
commit
1e5a0dc7c5
2
Makefile
2
Makefile
@ -272,7 +272,7 @@ black: reports
|
||||
@(set -o pipefail && $@ $(BLACK_ARGS) awx awxkit awx_collection | tee reports/$@.report)
|
||||
|
||||
.git/hooks/pre-commit:
|
||||
@echo "[ -z \$$AWX_IGNORE_BLACK ] && (black --check \`git diff --cached --name-only --diff-filter=AM | grep -E '\.py$\'\` || (echo 'To fix this, run \`make black\` to auto-format your code prior to commit, or set AWX_IGNORE_BLACK=1' && exit 1))" > .git/hooks/pre-commit
|
||||
@echo "./pre-commit.sh" > .git/hooks/pre-commit
|
||||
@chmod +x .git/hooks/pre-commit
|
||||
|
||||
genschema: reports
|
||||
|
||||
8
pre-commit.sh
Executable file
8
pre-commit.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
if [ -z $AWX_IGNORE_BLACK ]
|
||||
then
|
||||
black --check $(git diff --cached --name-only --diff-filter=AM | grep -E '\.py') || \
|
||||
(echo 'To fix this, run `make black` to auto-format your code prior to commit, or set AWX_IGNORE_BLACK=1' && \
|
||||
exit 1)
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user