Skip to content

Commit

Permalink
Style check shell scripts
Browse files Browse the repository at this point in the history
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
  • Loading branch information
FransUrbo authored and dasjoe committed May 24, 2015
1 parent b7cd6a1 commit bc4861c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,22 @@ dist-hook:
sed -i 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
$(distdir)/META

checkstyle:
checkstyle: cstyle shellcheck

cstyle:
@find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
! -name '*.mod.c' -type f -exec scripts/cstyle.pl {} \+

shellcheck:
@if type shellcheck > /dev/null 2>&1; then \
(find ${top_srcdir} -type f -name '*.sh.in' -o -type f \
-name '*.sh'; find etc/init.d/zfs*.in -type f) | \
grep -v 'zfs-script-config' | \
while read file; do \
shellcheck --format gcc "$$file"; \
done; \
fi

ctags:
$(RM) $(top_srcdir)/tags
find $(top_srcdir) -name .git -prune -o -name '*.[hc]' | xargs ctags
Expand Down

0 comments on commit bc4861c

Please sign in to comment.