Skip to content

Commit bc4861c

Browse files
FransUrbodasjoe
authored andcommitted
Style check shell scripts
If the command "shellcheck" exists, then find all shell scripts and run shellcheck on them. * Use 'gcc' format with shellcheck. * Exclude zfs-script-config.sh (which isn't really a script). Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#3428
1 parent b7cd6a1 commit bc4861c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Makefile.am

+13-1
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,22 @@ dist-hook:
4040
sed -i 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
4141
$(distdir)/META
4242

43-
checkstyle:
43+
checkstyle: cstyle shellcheck
44+
45+
cstyle:
4446
@find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
4547
! -name '*.mod.c' -type f -exec scripts/cstyle.pl {} \+
4648

49+
shellcheck:
50+
@if type shellcheck > /dev/null 2>&1; then \
51+
(find ${top_srcdir} -type f -name '*.sh.in' -o -type f \
52+
-name '*.sh'; find etc/init.d/zfs*.in -type f) | \
53+
grep -v 'zfs-script-config' | \
54+
while read file; do \
55+
shellcheck --format gcc "$$file"; \
56+
done; \
57+
fi
58+
4759
ctags:
4860
$(RM) $(top_srcdir)/tags
4961
find $(top_srcdir) -name .git -prune -o -name '*.[hc]' | xargs ctags

0 commit comments

Comments
 (0)