Patrick Georgi | d13e416 | 2012-02-16 20:28:42 +0100 | [diff] [blame] | 1 | #!/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 Georgi | d13e416 | 2012-02-16 20:28:42 +0100 | [diff] [blame] | 15 | # DESCR: Check for superfluous whitespace in the tree |
| 16 | |
| 17 | LC_ALL=C export LC_ALL |
Martin Roth | ee0f225 | 2018-09-01 17:13:38 -0600 | [diff] [blame] | 18 | EXCLUDELIST='^src/vendorcode/|^util/kconfig/|^util/nvidia/cbootimage$|COPYING|LICENSE|README|_shipped$|\.patch$|\.bin$|\.hex$|\.jpg$|\.ttf$|\.woff$|\.png$|\.eot$|\.vbt$|\.ico$' |
| 19 | INCLUDELIST="src util payloads Makefile* toolchain.inc" |
Martin Roth | 8600893 | 2018-09-01 14:54:33 -0600 | [diff] [blame] | 20 | |
| 21 | # shellcheck disable=SC2086,SC2046 |
| 22 | if uname | grep -qi "linux"; then |
Balazs Vinarz | 28def8b | 2019-01-18 11:23:29 +0100 | [diff] [blame] | 23 | grep -n -H "[[:space:]][[:space:]]*$" \ |
Martin Roth | 8600893 | 2018-09-01 14:54:33 -0600 | [diff] [blame] | 24 | $(git ls-files $INCLUDELIST | \ |
| 25 | grep -Ev "($EXCLUDELIST)" ) | \ |
| 26 | sed -e "s,^.*$,File & has lines ending with whitespace.," |
| 27 | else |
| 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.," |
| 35 | fi |