From 75149ef6b5fbc9fa1029992a4434b3e9900e01da Mon Sep 17 00:00:00 2001 From: theohax <81556890+theohax@users.noreply.github.com> Date: Thu, 16 Sep 2021 15:19:11 +0300 Subject: [PATCH] Fix CI clang-format script to tell if clang-format cannot be found (#3450) --- ci/clang-format-all.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ci/clang-format-all.sh b/ci/clang-format-all.sh index 17661f19..ee0b013c 100755 --- a/ci/clang-format-all.sh +++ b/ci/clang-format-all.sh @@ -2,7 +2,12 @@ set -e -REPO_ROOT=$(git rev-parse --show-toplevel) -cd "${REPO_ROOT}" -./ci/update-clang-format -find nano -iname '*.h' -o -iname '*.hpp' -o -iname '*.cpp' | xargs clang-format -i +CLANG_FORMAT="clang-format" +if [ $(builtin type -p "$CLANG_FORMAT") ]; then + REPO_ROOT=$(git rev-parse --show-toplevel) + cd "$REPO_ROOT" + ./ci/update-clang-format + find nano -iname '*.h' -o -iname '*.hpp' -o -iname '*.cpp' | xargs "$CLANG_FORMAT" -i +else + echo "'$CLANG_FORMAT' could not be detected in your PATH. Do you have it installed?" +fi