From 823b0a6e9ef4f7738a3cde8b535b7e17d633e58b Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Fri, 27 Oct 2023 00:24:51 -0400 Subject: [PATCH] Tell shellcheck to follow sourced files (#14377) Signed-off-by: Matt Lord --- misc/git/hooks/shellcheck | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/git/hooks/shellcheck b/misc/git/hooks/shellcheck index af9d8f8b37b..422022b2945 100755 --- a/misc/git/hooks/shellcheck +++ b/misc/git/hooks/shellcheck @@ -20,7 +20,9 @@ do # The -e SC1090,SC1091 suppressing warnings about trying to find # files imported with "source foo.sh". We only want to lint # the files modified as part of this current diff. - errors+=$(shellcheck -e SC1090,SC1091 "$file" 2>&1) + # The -x flag tells shellcheck to follow the files we source + # and properly validate them as well. + errors+=$(shellcheck -x -e SC1090,SC1091 "$file" 2>&1) done [ -z "$errors" ] && exit 0