Skip to content

Commit afdc588

Browse files
committed
Add one more condition to shellcheck git hook
1 parent 5146b88 commit afdc588

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.githooks/pre-commit/01-shellcheck.sh

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ exec_files=$(find $diff_files -exec sh -c 'head -n1 $1 | grep -qE '"'"'^#!(.*/|\
1313
# shellcheck disable=SC2086
1414
sh_files=$(find $diff_files \( -name '*.sh' -or -name '*.bash' \))
1515
all_files=`echo -e "$sh_files\n$exec_files" | sort | uniq`
16+
if [ -z "$all_files" ]; then
17+
echo "No shell files found to check"
18+
exit 0
19+
fi
1620
echo "Running shellcheck on the following files:"
1721
echo "$all_files"
1822
# shellcheck disable=SC2086

0 commit comments

Comments
 (0)