Stefan Reinauer | b18f522 | 2015-02-11 01:53:42 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # This file is part of the coreboot project. |
| 3 | # |
| 4 | # Copyright 2015 Google Inc. |
| 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 | # |
Martin Roth | 1ce2ba6 | 2016-08-29 15:40:57 -0600 | [diff] [blame] | 15 | # DESCR: Checkpatch on .c, .h, & Kconfig files in the tree |
Stefan Reinauer | b18f522 | 2015-02-11 01:53:42 +0100 | [diff] [blame] | 16 | |
| 17 | LC_ALL=C export LC_ALL |
Martin Roth | 1ce2ba6 | 2016-08-29 15:40:57 -0600 | [diff] [blame] | 18 | |
| 19 | # GNU BRE syntax list of files to examine |
| 20 | INCLUDED_FILES='.*\.[ch]\|Kconfig.*$' |
| 21 | |
| 22 | EXCLUDED_DIRS="^payloads/libpayload/util/kconfig\|\ |
| 23 | ^payloads/libpayload/curses/PDCurses\|\ |
| 24 | ^util/kconfig\|\ |
| 25 | ^src/vendorcode" |
| 26 | |
| 27 | # Space separated list of directories to test |
| 28 | if [ "$1" = "" ]; then |
| 29 | INCLUDED_DIRS="src util" |
| 30 | else |
| 31 | INCLUDED_DIRS="$1" |
| 32 | fi |
| 33 | |
| 34 | # We want word splitting here, so disable the shellcheck warnings |
| 35 | # shellcheck disable=SC2046,SC2086 |
| 36 | FILELIST=$( git ls-files $INCLUDED_DIRS | \ |
| 37 | grep $INCLUDED_FILES | \ |
| 38 | grep -v $EXCLUDED_DIRS ) |
| 39 | |
| 40 | for FILE in $FILELIST; do |
| 41 | util/lint/checkpatch.pl --show-types --file --quiet "$FILE" |
| 42 | done |