-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_oclint
executable file
·43 lines (36 loc) · 907 Bytes
/
do_oclint
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
#!/bin/bash
cpp_files=`ls *.cpp | egrep -v "^.*_test\.cpp$" | egrep -v "^qrc_.*\.cpp$" | egrep -v "^moc_.*\.cpp$"`
h_files=`ls *.h | egrep -v "^ui_.*\.h$"`
./oclint-0.10.3/bin/oclint -o oclint.log \
-disable-rule ShortVariableName \
$cpp_files \
$h_files \
-- \
-c -std=c++14 -fPIE \
-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/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"
# exit 1 # OCLint be mild
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