summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy2
-rw-r--r--Makefile4
-rw-r--r--platform/osx/bitrise-tidy.yml54
-rwxr-xr-xscripts/clang-tidy.sh17
4 files changed, 63 insertions, 14 deletions
diff --git a/.clang-tidy b/.clang-tidy
index b32f768630..17f2048f04 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1 +1 @@
-Checks: '-clang-analyzer-security.insecureAPI.rand'
+Checks: 'modernize-*,misc-static-assert,llvm-namespace-comment,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.uninitialized.UndefReturn'
diff --git a/Makefile b/Makefile
index 43bc32c376..5478685feb 100644
--- a/Makefile
+++ b/Makefile
@@ -306,11 +306,11 @@ compdb-osx: platform/osx/platform.gyp $(OSX_OUTPUT_PATH)/config.gypi
tidy: compdb tidy-$(HOST_PLATFORM)
tidy-linux:
- deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) platform-lib test
+ deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) headers
scripts/clang-tidy.sh $(LINUX_OUTPUT_PATH)/$(BUILDTYPE)
tidy-osx:
- deps/ninja/ninja-osx -C $(OSX_OUTPUT_PATH)/$(BUILDTYPE) platform-lib test
+ deps/ninja/ninja-osx -C $(OSX_OUTPUT_PATH)/$(BUILDTYPE) headers
scripts/clang-tidy.sh $(OSX_OUTPUT_PATH)/$(BUILDTYPE)
#### Miscellaneous targets #####################################################
diff --git a/platform/osx/bitrise-tidy.yml b/platform/osx/bitrise-tidy.yml
new file mode 100644
index 0000000000..ed4b6ab991
--- /dev/null
+++ b/platform/osx/bitrise-tidy.yml
@@ -0,0 +1,54 @@
+format_version: 1.1.0
+default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
+
+trigger_map:
+- pattern: "*"
+ is_pull_request_allowed: true
+ workflow: primary
+
+workflows:
+ primary:
+ steps:
+ - script:
+ title: Check for skipping CI
+ inputs:
+ - content: |-
+ #!/bin/bash
+ if [[ -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_SUBJECT | sed -n '/\[skip ci\]/p')" ||
+ -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_SUBJECT | sed -n '/\[ci skip\]/p')" ||
+ -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_BODY | sed -n 's/\[skip ci\]/p')" ||
+ -n "$(echo $GIT_CLONE_COMMIT_MESSAGE_BODY | sed -n 's/\[ci skip\]/p')" ]]; then
+ envman add --key SKIPCI --value true
+ else
+ envman add --key SKIPCI --value false
+ fi
+ - script:
+ title: Run build script
+ run_if: '{{enveq "SKIPCI" "false"}}'
+ inputs:
+ - content: |-
+ #!/bin/bash
+ set -eu -o pipefail
+ export BUILDTYPE=Release
+ make compdb
+ .mason/mason install clang-tidy 3.8
+ make tidy
+ - is_debug: 'no'
+ - slack:
+ title: Post to Slack
+ run_if: '{{enveq "SKIPCI" "false"}}'
+ inputs:
+ - webhook_url: "$SLACK_HOOK_URL"
+ - channel: "#gl-bots"
+ - from_username: 'Bitrise clang-tidy'
+ - from_username_on_error: 'Bitrise clang-tidy'
+ - message: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}>
+ for <https://github.com/mapbox/mapbox-gl-native/compare/${BITRISE_GIT_BRANCH}|mapbox/mapbox-gl-native@${BITRISE_GIT_BRANCH}>
+ by ${GIT_CLONE_COMMIT_COMMITER_NAME}
+ passed'
+ - message_on_error: '<${BITRISE_BUILD_URL}|Build #${BITRISE_BUILD_NUMBER}>
+ for <https://github.com/mapbox/mapbox-gl-native/compare/${BITRISE_GIT_BRANCH}|mapbox/mapbox-gl-native@${BITRISE_GIT_BRANCH}>
+ by ${GIT_CLONE_COMMIT_COMMITER_NAME}
+ failed'
+ - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png
+ - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png
diff --git a/scripts/clang-tidy.sh b/scripts/clang-tidy.sh
index 76773e475a..e6bb3794a2 100755
--- a/scripts/clang-tidy.sh
+++ b/scripts/clang-tidy.sh
@@ -3,24 +3,19 @@
set -e
set -o pipefail
-directory=$1
-
export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
-command -v ${CLANG_TIDY:-clang-tidy} >/dev/null 2>&1 || {
- echo "Can't find ${CLANG_TIDY:-clang-tidy} in PATH."
+CLANG_TIDY=${CLANG_TIDY:-$(mason prefix clang-tidy 3.8)/bin/clang-tidy}
+
+command -v ${CLANG_TIDY} >/dev/null 2>&1 || {
+ echo "Can't find ${CLANG_TIDY} in PATH."
if [ -z ${CLANG_TIDY} ]; then
echo "Alternatively, you can set CLANG_TIDY to point to clang-tidy."
fi
- if [ `uname -s` = 'Linux' ]; then
- echo "On Debian-based distros, you can install them via 'apt-get install clang-tidy'"
- elif [ `uname -s` = 'Darwin' ]; then
- echo "On OS X, you can install them via 'brew install llvm --with-clang --with-clang-extra-tools'"
- fi
exit 1
}
-cd "${directory}"
+cd $1
git ls-files '../../../src/mbgl/*.cpp' '../../../platform/*.cpp' '../../../test/*.cpp' | \
- xargs -I{} -P ${JOBS} ${CLANG_TIDY:-clang-tidy} -header-filter='\/mbgl\/' {}
+ xargs -I{} -P ${JOBS} ${CLANG_TIDY} {} -p=. -header-filter='mbgl' || exit 1