Commit 1156775f authored by Pádraig Ó Conbhuí's avatar Pádraig Ó Conbhuí
Browse files

Added searching homebrew for clang-tidy by default.

parent 7d0ab95a
......@@ -9,8 +9,8 @@ suffixes=( .cpp .hpp )
#
# Set defaults for the optional arguments
CLANG_TIDY_EXECUTABLE=$(which clang-tidy)
VERBOSE=
: ${CLANG_TIDY_EXECUTABLE:=$(which clang-tidy)}
: ${VERBOSE:=}
declare -a options
declare -a clang_tidy_options
......@@ -21,6 +21,13 @@ do
case "$1" in
--clang-tidy=*)
CLANG_TIDY_EXECUTABLE="$(echo "$1" | sed 's/--clang-tidy=//')"
if [[ -z "${CLANG_TIDY_EXECUTABLE}" ]]
then
echo >&2 "Error: No value passed for --clang-tidy"
exit 1
fi
options=( "${options[@]}" "$1" )
shift
;;
......@@ -73,10 +80,18 @@ do
esac
done
# Which clang-tidy failed, no clang-tidy set on command line
if [[ -z "${CLANG_TIDY_EXECUTABLE}" ]]
then
echo >&2 "Error: No clang-tidy executable found!"
exit 1
# Check homebrew, if it's installed
if [[ -n "$(which brew)" ]]
then
CLANG_TIDY_EXECUTABLE=$(brew --prefix llvm)/bin/clang-tidy
options=( "${options[@]}" "--clang-tidy=${CLANG_TIDY_EXECUTABLE}" )
else
echo >&2 "Error: No clang-tidy executable found!"
exit 1
fi
fi
echo_verbose() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment