/
do_clang-tidy
executable file
·95 lines (79 loc) · 2.35 KB
/
do_clang-tidy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
clang-tidy {sado_r*.cpp,sado_r*.h} \
-checks=misc* \
-- \
-std=c++14 \
-stdlib=libc++ \
-fPIE \
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB \
-I../BoostGraphTutorial/BoostGraphTutorial \
-I../gausser \
-I../RibiLibraries/qwt-6.1/src \
-I../SurfacePlotter \
-I/usr/include/c++/5 \
-I/usr/include/x86_64-linux-gnu/c++/5 \
-I/usr/include/qt4 \
-I/usr/include/qt4/QtCore \
-I/usr/include/qt4/QtGui \
-I/usr/include/qt4/QtTest \
-I/usr/include/qt4/QtWidgets
exit 0
git_branch=`git rev-parse --abbrev-ref HEAD`
cpp_files=`ls *.cpp | egrep -v "^jaan_.*\.cpp$" | egrep -v "^sado_.*\.cpp$" | egrep -v "^qrc_.*\.cpp$" | egrep -v "^moc_.*\.cpp$" | egrep -v "^.*_test\.cpp$"`
echo ".cpp files that will be analysed: "$cpp_files
h_files=`ls *.h | egrep -v "^jaan_.*\.h$" | egrep -v "^sado_.*\.h$" | egrep -v "^ui_.*\.h$"`
echo ".h files that will be analysed: "$h_files
qt4_folder="usr/include/qt4/QtGui"
qt5_folder="usr/include/qt5/QtWidgets"
clang-tidy sado_main.cpp -- -std=c++14 -I../gausser -I/usr/include/qt4 -I/usr/include/qt4/QtGui
clang-tidy sado_main.cpp \
-- \
-std=c++14 -fPIE \
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB \
-I../BoostGraphTutorial/BoostGraphTutorial \
-I../RibiLibraries/qwt-6.1/src \
-I../SurfacePlotter \
-I/usr/include/c++/5 \
-I/usr/include/x86_64-linux-gnu/c++/5 \
-I/usr/include/qt5 \
-I/usr/include/qt5/QtCore \
-I/usr/include/qt5/QtGui \
-I/usr/include/qt5/QtTest \
-I/usr/include/qt5/QtWidgets
clang-tidy \
-disable-rule ShortVariableName \
$cpp_files \
$h_files \
-- \
-c -std=c++14 -fPIE \
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB \
-I../BoostGraphTutorial/BoostGraphTutorial \
-I../RibiLibraries/qwt-6.1/src \
-I../SurfacePlotter \
-I/usr/include/c++/5 \
-I/usr/include/x86_64-linux-gnu/c++/5 \
-I/usr/include/qt5 \
-I/usr/include/qt5/QtCore \
-I/usr/include/qt5/QtGui \
-I/usr/include/qt5/QtTest \
-I/usr/include/qt5/QtWidgets
cat oclint.log
# Will be 0 if success
# Will be 1 if fail
fail=`egrep "Compiler Errors" oclint.log | wc -l`
if [ $fail -eq 1 ];
then
echo "OCLint: Compiler error, can only be warnings :-("
else
echo "OCLint: OK"
fi
# Will be 1 if success
# Will be 0 if fail
success=`egrep "FilesWithViolations=0 P1=0 P2=0 P3=0" oclint.log | wc -l`
if [ $success -eq 1 ];
then
echo "OCLint: OK"
else
echo "OCLint: Fail"
exit 1
fi