summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy2
-rw-r--r--Makefile15
-rwxr-xr-xscripts/clang-tools.sh15
3 files changed, 13 insertions, 19 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 4358e3bb3f..6d080b2183 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,2 +1,2 @@
-Checks: 'modernize-*,misc-static-assert,llvm-namespace-comment,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.uninitialized.UndefReturn,-clang-analyzer-core.StackAddressEscape,-clang-analyzer-core.CallAndMessage'
+Checks: 'modernize-*,misc-static-assert,llvm-namespace-comment,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.uninitialized.UndefReturn,-clang-analyzer-core.StackAddressEscape,-clang-analyzer-core.CallAndMessage,-clang-diagnostic-unused-command-line-argument,-clang-analyzer-core.uninitialized.*'
HeaderFilterRegex: '\/mbgl\/'
diff --git a/Makefile b/Makefile
index 791afed3c5..bb208175c8 100644
--- a/Makefile
+++ b/Makefile
@@ -168,11 +168,11 @@ clang-tools: compdb
.PHONY: tidy
tidy: clang-tools
- scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE)
+ scripts/clang-tools.sh $(MACOS_COMPDB_PATH)
.PHONY: check
check: clang-tools
- scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) --diff
+ scripts/clang-tools.sh $(MACOS_COMPDB_PATH) --diff
endif
@@ -304,23 +304,18 @@ coverage: test
compdb: $(LINUX_BUILD)
# Ninja generator already outputs the file at the right location
-.PHONY: tidy
-tidy: compdb
- $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-headers
- scripts/clang-tidy.sh $(LINUX_OUTPUT_PATH)
-
.PHONY: clang-tools
-clang-tools:
+clang-tools: compdb
if test -z $(CLANG_TIDY); then .mason/mason install clang-tidy 3.8.0; fi
if test -z $(CLANG_FORMAT); then .mason/mason install clang-format 3.8.0; fi
- deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH) headers
+ $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-headers
.PHONY: tidy
tidy: clang-tools
scripts/clang-tools.sh $(LINUX_OUTPUT_PATH)
.PHONY: check
-check: compdb clang-tools
+check: clang-tools
scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) --diff
endif
diff --git a/scripts/clang-tools.sh b/scripts/clang-tools.sh
index 6a10740c77..fa9825f4a4 100755
--- a/scripts/clang-tools.sh
+++ b/scripts/clang-tools.sh
@@ -42,15 +42,14 @@ function check_format() {
export CLANG_TIDY CLANG_FORMAT
export -f check_tidy check_format
-git diff-index --quiet HEAD || {
- echo "Your repository contains unstaged and/or uncommitted changes."
- echo "Please commit all changes before proceeding."
- exit 1
-}
-
echo "Running clang checks... (this might take a while)"
-if [ -n $2 ] && [ $2 == "--diff" ]; then
+if [[ -n $2 ]] && [[ $2 == "--diff" ]]; then
+ git diff-index --quiet HEAD || {
+ echo "Your repository contains unstaged and/or uncommitted changes."
+ echo "Please commit all changes before proceeding."
+ exit 1
+ }
DIFF_FILES=$(for file in `git diff origin/master..HEAD --name-only | grep "pp$"`; do echo $file; done)
if [[ -n $DIFF_FILES ]]; then
echo "${DIFF_FILES}" | xargs -I{} -P ${JOBS} bash -c 'check_tidy --fix' {}
@@ -63,6 +62,6 @@ if [ -n $2 ] && [ $2 == "--diff" ]; then
fi
echo "All looks good!"
else
- git ls-files '${CDUP}/src/mbgl/*.cpp' '${CDUP}/platform/*.cpp' '${CDUP}/test/*.cpp' | \
+ git ls-files "${CDUP}/src/mbgl/*.cpp" "${CDUP}/platform/*.cpp" "${CDUP}/test/*.cpp" | \
xargs -I{} -P ${JOBS} bash -c 'check_tidy' {}
fi