-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint.sh
executable file
·32 lines (25 loc) · 920 Bytes
/
lint.sh
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
#!/bin/sh
if [ ! -f cpplint.py ]; then
wget https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py
chmod +x cpplint.py
fi
#filter some rule we needn't
HEADER_FILTER='--filter=-runtime/int,-runtime/explicit'
SOURCE_FILTER='--filter=-runtime/int,-runtime/string,-build/c++11'
TESTES_FILTER='--filter=-whitespace/line_length'
#use default rule set:
# ./lint.sh verbose
if [ "$1" = "verbose" ]; then
HEADER_FILTER=''
SOURCE_FILTER=''
TESTES_FILTER=''
fi
# for headers
echo '#######################################################'
find include -name *.h | xargs ./cpplint.py --root=include $HEADER_FILTER
# for sources
echo '#######################################################'
find src -name *.cc | xargs ./cpplint.py $SOURCE_FILTER
# for tests
echo '#######################################################'
find tests -name *.cc | xargs ./cpplint.py $TESTES_FILTER