summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-13 23:03:46 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-14 05:09:16 +0300
commitc879c26ddcf5bf027d2789b27d2bdc2ea6087aac (patch)
treeffff815fb910d6182974c1120ad32d9596f6f803 /tools
parent2980c3ca3737afaf39cc8a8595737f131adacf5d (diff)
downloadManaVerse-c879c26ddcf5bf027d2789b27d2bdc2ea6087aac.tar.gz
ManaVerse-c879c26ddcf5bf027d2789b27d2bdc2ea6087aac.tar.bz2
ManaVerse-c879c26ddcf5bf027d2789b27d2bdc2ea6087aac.tar.xz
ManaVerse-c879c26ddcf5bf027d2789b27d2bdc2ea6087aac.zip
add clang-tidy checks.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ci/jobs/clang_tidy.sh28
-rwxr-xr-xtools/ci/scripts/clang_tidy.sh5
2 files changed, 33 insertions, 0 deletions
diff --git a/tools/ci/jobs/clang_tidy.sh b/tools/ci/jobs/clang_tidy.sh
new file mode 100755
index 000000000..593d986f4
--- /dev/null
+++ b/tools/ci/jobs/clang_tidy.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+export LOGFILE=tidy.log
+
+source ./tools/ci/scripts/init.sh
+
+rm "logs/clang_tidy.txt"
+
+cd src
+
+find . -type f -name "*.cpp" -exec ../tools/ci/scripts/clang_tidy.sh "${FLAGS}" "" {} \; >>../logs/clang_tidy.txt
+check_error $?
+find . -type f -name "*.cc" -exec ../tools/ci/scripts/clang_tidy.sh "${FLAGS}" "-DUNITTESTS -DUNITTESTS_CATCH" {} \; >>../logs/clang_tidy.txt
+check_error $?
+find . -type f -name "*.h" -exec ../tools/ci/scripts/clang_tidy.sh "${FLAGS}" "" {} \; >>../logs/clang_tidy.txt
+check_error $?
+
+cd ..
+
+grep "warning:" logs/clang_tidy.txt \
+| grep -v "src/test/doctest.h" \
+| grep -v "src/test/catch.hpp" \
+| grep -v "src/sdl2gfx/" \
+>${ERRFILE}
+
+run_check_warnings
+
+echo ok
diff --git a/tools/ci/scripts/clang_tidy.sh b/tools/ci/scripts/clang_tidy.sh
new file mode 100755
index 000000000..56761379a
--- /dev/null
+++ b/tools/ci/scripts/clang_tidy.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+dir=`pwd`
+
+clang-tidy -checks="$1" "$3" -- -std=c++11 -x c++ -DENABLE_LIBXML -DTMWA_SUPPORT -DDEBUGBUILD $2 -I$dir -I/usr/include -I/usr/include/SDL -I/usr/include/libxml2