mainboard/dell: Add new mainboard XPS 8300 (Sandy Bridge)
[coreboot.git] / util / lint / lint-007-checkpatch
blobf8a8095e39af16d7835abd34bd7c9cd28eaa8717
1 #!/usr/bin/env sh
3 # SPDX-License-Identifier: GPL-2.0-only
5 # DESCR: Checkpatch on .c, .h, & Kconfig files in the tree
7 LINTDIR="$(
8 cd -- "$(dirname "$0")" > /dev/null 2>&1 || return
9 pwd -P
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\|\
23 ^util/inteltool\|\
24 ^util/kconfig\|\
25 ^util/superiotool\|\
26 ^Documentation"
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 -
38 exit $?
39 # Space separated list of directories to test
40 else
41 INCLUDED_DIRS="$1"
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"
52 done