Skip to content
10 changes: 10 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
Checks: >
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "-*" is needed?
I thought that plan was enable "performance-faster-string-find", "performance-for-range-copy".

Checks: > performance-faster-string-find, performance-for-range-copy, 

Are you sure that all "clang-diagnostic-" , "clang-analyzer-" checks are already fixed?

Copy link
Contributor Author

@JohnCoconut JohnCoconut Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crazyhappygame clang-tidy enables a lot of default options. The -* option is to remove all options currently enabled.

-*,
performance-faster-string-find,
performance-for-range-copy,

WarningsAsErrors: '*'
HeaderFilterRegex: '/(?!external)/.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ matrix:
- secure: M5lyDs0qai15mWHzJdkh0WPfVJJmVZu6SWtYULxatukGPXVwoQvmEtYAwAW+iz6aM+tXksQ/mk6nW5L8UFbHm+n6yrsa5bZU9sGXjilPE8p8bLFYDmIbPRazU+E6pBP3J2CDoAm0XnWkiYQ8feTxKTo6ysLnHAEjyaHTw0+Q1GM=
sudo: required
language: cpp
# clang-tidy
- os: linux
dist: xenial
env: BUILD_TARGET=linux_clang_tidy
language: cpp
sudo: required
# mac_cmake
- os: osx
env: BUILD_TARGET=mac_cmake
Expand Down
3 changes: 3 additions & 0 deletions tools/travis-scripts/before-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ function install_environement_for_pull_request()
if [ "$BUILD_TARGET" == "linux" ]; then
install_linux_environment
fi
if [ "$BUILD_TARGET" == "linux_clang_tidy" ]; then
install_linux_environment
fi
fi

if [ "$TRAVIS_OS_NAME" == "osx" ]; then
Expand Down
15 changes: 15 additions & 0 deletions tools/travis-scripts/run-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ function build_linux()
cmake --build .
}

function build_linux_clang_tidy()
{
echo "Building clang tidy test on Linux ..."
cd $COCOS2DX_ROOT/build
mkdir -p clang-tidy-build
cd clang-tidy-build
cmake ../.. -DCMAKE_EXPORT_COMPILE_COMMANDS=on
python $(dirname $(dirname $(readlink -f `which clang-tidy`)))/share/clang/run-clang-tidy.py
}

function build_mac()
{
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN`
Expand Down Expand Up @@ -291,6 +301,11 @@ function run_pull_request()
build_linux
fi

# linux_clang_tidy_test
if [ $BUILD_TARGET == 'linux_clang_tidy' ]; then
build_linux_clang_tidy
fi

# android
if [ $BUILD_TARGET == 'android_cpp_ndk-build' ]; then
build_android_cpp_ndk-build
Expand Down