3 # SPDX-License-Identifier: GPL-2.0-only
5 # DESCR: Check for superfluous whitespace in the tree
8 cd -- "$
(dirname "$0")" > /dev/null 2>&1 || return
11 # shellcheck source=helper_functions.sh
12 .
"${LINTDIR}/helper_functions.sh"
14 EXCLUDELIST
='^src/vendorcode/|^util/kconfig/|^util/nvidia/cbootimage|^util/goswid|__pycache__|COPYING|LICENSE|README|_shipped$|\.patch$|\.bin$|\.hex$|\.jpg$|\.gif$|\.ttf$|\.woff$|\.png$|\.eot$|\.vbt$|\.ico$|\.md$'
15 INCLUDELIST
="src util payloads Makefile* toolchain.inc tests"
17 # shellcheck disable=SC2086,SC2046
18 if uname |
grep -qi "linux"; then
19 grep -n -H "[[:space:]][[:space:]]*$" \
20 $
(${FIND_FILES} ${INCLUDELIST} ${FINDOPTS} | \
21 grep -Ev "($EXCLUDELIST)" ) | \
22 sed -e "s,^.*$,File & has lines ending with whitespace.,"
24 # The above form is much (100x) faster, but doesn't work
25 # on all systems. A for loop also works but takes 30% longer
26 ${FIND_FILES} ${INCLUDELIST} ${FINDOPTS}| \
27 grep -Ev "($EXCLUDELIST)" | \
29 grep -l "[[:space:]][[:space:]]*$" % | \
30 sed -e "s,^.*$,File & has lines ending with whitespace.,"