blob: b4033e09c5d1411a1f98fb62b1bfd5d2dc2fd997 [file] [log] [blame]
Stefan Reinauerb18f5222015-02-11 01:53:42 +01001#!/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 Roth1ce2ba62016-08-29 15:40:57 -060015# DESCR: Checkpatch on .c, .h, & Kconfig files in the tree
Stefan Reinauerb18f5222015-02-11 01:53:42 +010016
17LC_ALL=C export LC_ALL
Martin Roth1ce2ba62016-08-29 15:40:57 -060018
19# GNU BRE syntax list of files to examine
20INCLUDED_FILES='.*\.[ch]\|Kconfig.*$'
21
22EXCLUDED_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
28if [ "$1" = "" ]; then
29 INCLUDED_DIRS="src util"
30else
31 INCLUDED_DIRS="$1"
32fi
33
34# We want word splitting here, so disable the shellcheck warnings
35# shellcheck disable=SC2046,SC2086
36FILELIST=$( git ls-files $INCLUDED_DIRS | \
37 grep $INCLUDED_FILES | \
38 grep -v $EXCLUDED_DIRS )
39
40for FILE in $FILELIST; do
41 util/lint/checkpatch.pl --show-types --file --quiet "$FILE"
42done