3 # SPDX-License-Identifier: GPL-2.0-only
5 # DESCR: Checkpatch on .c, .h, & Kconfig files in the tree
8 cd -- "$
(dirname "$0")" > /dev/null 2>&1 || return
12 # shellcheck source=helper_functions.sh
13 .
"${LINTDIR}/helper_functions.sh"
15 # GNU BRE syntax list of files to examine
16 INCLUDED_FILES
='.*\.[ch]\|Kconfig.*$'
18 EXCLUDED_DIRS
="^payloads/libpayload/util/kconfig\|\
19 ^payloads/libpayload/curses/PDCurses\|\
20 ^src/vendorcode/wuffs\|\
21 ^util/coreboot-configurator\|\
22 ^util/crossgcc/patches\|\
28 opts
="--max-line-length 96"
30 # default: test src and util
31 if [ "$1" = "" ]; then
32 INCLUDED_DIRS
="src util tests"
33 # special mode: take diff from stdin, but exclude the dirs
34 elif [ "$1" = "diff" ]; then
35 args
=$
( echo $EXCLUDED_DIRS | \
36 sed -e 's,\\|, ,g' -e 's,\^,--exclude=,g' )
37 util
/lint
/checkpatch.pl
--quiet --no-signoff $opts $args -
39 # Space separated list of directories to test
44 # We want word splitting here, so disable the shellcheck warnings
45 # shellcheck disable=SC2046,SC2086
46 FILELIST
=$
( ${FIND_FILES} $INCLUDED_DIRS | \
47 grep $INCLUDED_FILES | \
48 grep -v $EXCLUDED_DIRS )
50 for FILE
in $FILELIST; do
51 util
/lint
/checkpatch.pl
--show-types --file --quiet $opts "$FILE"