Merge pull request #9684 from ryanpetrello/black-help-message

add a helpful error message for people who want to run `make black`

Reviewed-by: Shane McDonald <me@shanemcd.com>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-03-24 16:48:56 +00:00 committed by GitHub
commit 633f5419e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,10 +272,11 @@ reports:
mkdir -p $@
black: reports
command -v black >/dev/null 2>&1 || { echo "could not find black on your PATH, you may need to \`pip install black\`, or set AWX_IGNORE_BLACK=1" && exit 1; }
(set -o pipefail && $@ $(BLACK_ARGS) awx awxkit awx_collection | tee reports/$@.report)
.git/hooks/pre-commit:
echo "black --check \`[ -z \$$AWX_IGNORE_BLACK ] && git diff --cached --name-only | 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 "[ -z \$$AWX_IGNORE_BLACK ] && (black --check \`git diff --cached --name-only | 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
chmod +x .git/hooks/pre-commit
genschema: reports