check.sh
768 Bytes
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
#!/bin/sh
# Copyright 2017 Kaspar Schleiser <kaspar@schleiser.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
: ${RIOTBASE:=$(pwd)}
. ${RIOTBASE}/dist/tools/ci/changed_files.sh
EXIT_CODE=0
filter() {
if [ $QUIET -eq 0 ]; then
cat
else
grep '^---' | cut -f 2 -d ' '
fi
}
_headercheck() {
OUT="$(${RIOTBASE}/dist/tools/headerguards/headerguards.py ${FILES} | filter)"
if [ -n "$OUT" ]; then
EXIT_CODE=1
echo "$OUT"
fi
}
: ${FILES:=$(FILEREGEX='\.h$' changed_files)}
if [ -z "${FILES}" ]; then
exit
fi
: ${QUIET:=0}
if [ -z "$*" ]; then
_headercheck
fi
exit $EXIT_CODE