soc/intel: Clean up some includes
[coreboot.git] / util / lint / lint-stable-003-whitespace
blob82b46b02ad9446107bf9e868c7e2894e40cb1af1
1 #!/usr/bin/env sh
3 # SPDX-License-Identifier: GPL-2.0-only
5 # DESCR: Check for superfluous whitespace in the tree
7 LINTDIR="$(
8 cd -- "$(dirname "$0")" > /dev/null 2>&1 || return
9 pwd -P
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.,"
23 else
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)" | \
28 xargs -I % \
29 grep -l "[[:space:]][[:space:]]*$" % | \
30 sed -e "s,^.*$,File & has lines ending with whitespace.,"