blob: b2011e7f65de75be9527838c2b8ba1b79cb80052 [file] [log] [blame]
Patrick Georgid13e4162012-02-16 20:28:42 +01001#!/bin/sh
2# This file is part of the coreboot project.
3#
4# Copyright (C) 2011 Patrick Georgi <patrick@georgi-clan.de>
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; version 2 of the License.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
Patrick Georgid13e4162012-02-16 20:28:42 +010015# DESCR: Check for superfluous whitespace in the tree
16
17LC_ALL=C export LC_ALL
Martin Rothee0f2252018-09-01 17:13:38 -060018EXCLUDELIST='^src/vendorcode/|^util/kconfig/|^util/nvidia/cbootimage$|COPYING|LICENSE|README|_shipped$|\.patch$|\.bin$|\.hex$|\.jpg$|\.ttf$|\.woff$|\.png$|\.eot$|\.vbt$|\.ico$'
19INCLUDELIST="src util payloads Makefile* toolchain.inc"
Martin Roth86008932018-09-01 14:54:33 -060020
21# shellcheck disable=SC2086,SC2046
22if uname | grep -qi "linux"; then
Balazs Vinarz28def8b2019-01-18 11:23:29 +010023 grep -n -H "[[:space:]][[:space:]]*$" \
Martin Roth86008932018-09-01 14:54:33 -060024 $(git ls-files $INCLUDELIST | \
25 grep -Ev "($EXCLUDELIST)" ) | \
26 sed -e "s,^.*$,File & has lines ending with whitespace.,"
27else
28 # The above form is much (100x) faster, but doesn't work
29 # on all systems. A for loop also works but takes 30% longer
30 git ls-files $INCLUDELIST | \
31 grep -Ev "($EXCLUDELIST)" | \
32 xargs -I % \
33 grep -l "[[:space:]][[:space:]]*$" % | \
34 sed -e "s,^.*$,File & has lines ending with whitespace.,"
35fi