From 1d1630bc1cf1e29cf9bff6c17b27142bb44c8696 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 24 Mar 2021 12:02:09 -0400 Subject: [PATCH] add a helpful error message for people who want to run `make black` --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c85fbcc24c..fb6e25e657 100644 --- a/Makefile +++ b/Makefile @@ -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