summaryrefslogtreecommitdiff
path: root/tools/ci/jobs/cpplint.sh
blob: 7bbccf2715a6ab603b2ea16afd0eed07d3de4de1 (plain) (blame)
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
#!/usr/bin/env bash

export LOGFILE=cpplint.log

source ./tools/ci/scripts/init.sh

# Re-download if not executable or older than a day
if [[ ! -x cpplint.py \
   || $(find cpplint.py -mtime 1 -print) ]]; then
	tools/ci/scripts/retry.sh wget "https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py"
	chmod +x cpplint.py
fi

declare -a args

args+=("--filter=\
-build/include,\
-whitespace/braces,-whitespace/operators,-runtime/references,\
-runtime/threadsafe_fn,-readability/streams,\
-runtime/rtti,\
-whitespace/newline,-whitespace/labels,\
-runtime/indentation_namespace,\
-whitespace/indent,\
-whitespace/parens,\
-runtime/int,\
-readability/todo,\
-runtime/arrays,\
-runtime/printf,\
-whitespace/empty_loop_body,\
-build/c++11,\
-readability/fn_size,\
-build/header_guard,\
-readability/braces,\
-legal/copyright,\
-whitespace/semicolon,\
-readability/namespace,\
-readability/casting,\
-readability/inheritance,\
-runtime/string,\
-build/c++tr1"\
)

find src \
     -type f \
     -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.cc" \
     -exec ./cpplint.py "${args[@]}" {} \+ 2>${ERRFILE}2

grep ":  " ${ERRFILE}2 | grep -v -e "src/debug/" \
                                 -e "unittests/doctest.h" \
                                 -e "unittests/catch.hpp" \
                                 -e "debug/fast_mutex" \
                                 -e "sdl2gfx/SDL2" \
                                 >${ERRFILE}

rm ${ERRFILE}2

run_check_warnings

echo ok