util/lint/lint-stable-019: Update grep '\s' to [[:blank:]]
[coreboot.git] / util / lint / lint-stable-019-header-files
blobc839dc5fe87b2d565ec3cdc992d8b3d36878e15d
1 #!/usr/bin/env sh
3 # SPDX-License-Identifier: GPL-2.0-only
5 # DESCR: Check for auto-included headers
7 LC_ALL=C export LC_ALL
9 INCLUDED_DIRS='^src/'
10 EXCLUDED_FILES='src/include/kconfig.h'
12 # TODO: Add rules when those patches are complete
13 HEADER_FILES="k*config"
15 # Use git grep if the code is in a git repo, otherwise use grep.
16 if [ -n "$(command -v git)" ] && \
17 [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]
18 then
19 GREP_FILES="git grep -n"
20 else
21 GREP_FILES="grep -rn"
24 for header in $HEADER_FILES; do
25 ${GREP_FILES} "#[[:blank:]]*include[[:blank:]]\+[\"<][[:blank:]]*${header}\.h[[:blank:]]*[\">]" | \
26 grep "$INCLUDED_DIRS" | \
27 grep -v "$EXCLUDED_FILES"; \
28 done