Add `--enable=all` to ShellCheck by default
Change enforced shell type from `dash` to `sh` and excluded `SC2039` and `SC3043` by default. `local` keyword is accepted by all POSIX shells from practical point of view. There is no need anymore to enforce dash so `local` is accepted. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #13020
This commit is contained in:
parent
add15e9539
commit
8df0bde321
|
@ -9,7 +9,6 @@ CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb
|
||||||
|
|
||||||
# TODO: #12084: SHELLCHECKDIRS += vdev_id
|
# TODO: #12084: SHELLCHECKDIRS += vdev_id
|
||||||
SHELLCHECKDIRS = fsck_zfs zed zpool zvol_wait
|
SHELLCHECKDIRS = fsck_zfs zed zpool zvol_wait
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
||||||
if USING_PYTHON
|
if USING_PYTHON
|
||||||
SUBDIRS += arcstat arc_summary dbufstat
|
SUBDIRS += arcstat arc_summary dbufstat
|
||||||
|
|
|
@ -5,4 +5,3 @@ dist_sbin_SCRIPTS = fsck.zfs
|
||||||
|
|
||||||
SUBSTFILES += $(dist_sbin_SCRIPTS)
|
SUBSTFILES += $(dist_sbin_SCRIPTS)
|
||||||
|
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ AM_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS)
|
||||||
|
|
||||||
SUBDIRS = zed.d
|
SUBDIRS = zed.d
|
||||||
SHELLCHECKDIRS = $(SUBDIRS)
|
SHELLCHECKDIRS = $(SUBDIRS)
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zed
|
sbin_PROGRAMS = zed
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,7 @@ dist_zedconf_DATA = \
|
||||||
zed.rc
|
zed.rc
|
||||||
|
|
||||||
SHELLCHECKSCRIPTS = zed-functions.sh zed.rc
|
SHELLCHECKSCRIPTS = zed-functions.sh zed.rc
|
||||||
SHELLCHECK_OPTS = --enable=all
|
SHELLCHECK_SHELL = sh
|
||||||
SHELLCHECK_SHELL = dash
|
|
||||||
|
|
||||||
zedexecdir = $(zfsexecdir)/zed.d
|
zedexecdir = $(zfsexecdir)/zed.d
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS)
|
||||||
|
|
||||||
DEFAULT_INCLUDES += -I$(srcdir)
|
DEFAULT_INCLUDES += -I$(srcdir)
|
||||||
|
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zpool
|
sbin_PROGRAMS = zpool
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,3 @@ include $(top_srcdir)/config/Shellcheck.am
|
||||||
|
|
||||||
dist_bin_SCRIPTS = zvol_wait
|
dist_bin_SCRIPTS = zvol_wait
|
||||||
|
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
.PHONY: shellcheck
|
.PHONY: shellcheck
|
||||||
shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
||||||
|
|
||||||
|
# ShellCheck exclusions
|
||||||
|
#
|
||||||
|
# ShellCheck can't follow non-constant source. Use a directive to specify location. [SC1090]
|
||||||
|
# Not following: a was not specified as input (see shellcheck -x). [SC1091]
|
||||||
|
# Prefer putting braces around variable references even when not strictly required. [SC2250]
|
||||||
|
# In POSIX sh, 'local' is undefined. [SC2039] # older ShellCheck versions
|
||||||
|
# In POSIX sh, 'local' is undefined. [SC3043] # newer ShellCheck versions
|
||||||
if HAVE_SHELLCHECK
|
if HAVE_SHELLCHECK
|
||||||
[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck --format=gcc --exclude=SC1090,SC1091,SC2250 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") $(SHELLCHECK_OPTS) $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck --format=gcc --enable=all --exclude=SC1090,SC1091,SC2039,SC2250,SC3043 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") $(SHELLCHECK_OPTS) $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
||||||
else
|
else
|
||||||
@[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed"
|
@[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed"
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -10,4 +10,3 @@ endif
|
||||||
DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp
|
DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp
|
||||||
|
|
||||||
SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs
|
SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -10,4 +10,3 @@ SUBSTFILES += $(noinst_DATA)
|
||||||
|
|
||||||
SHELLCHECKSCRIPTS = $(noinst_DATA)
|
SHELLCHECKSCRIPTS = $(noinst_DATA)
|
||||||
SHELLCHECK_SHELL = bash
|
SHELLCHECK_SHELL = bash
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -5,4 +5,3 @@ EXTRA_DIST = \
|
||||||
zfs-trace.sh
|
zfs-trace.sh
|
||||||
|
|
||||||
SHELLCHECKSCRIPTS = zfs-trace.sh
|
SHELLCHECKSCRIPTS = zfs-trace.sh
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ pkgdracutdir = $(dracutdir)/modules.d/02zfsexpandknowledge
|
||||||
pkgdracut_SCRIPTS = \
|
pkgdracut_SCRIPTS = \
|
||||||
module-setup.sh
|
module-setup.sh
|
||||||
|
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
SUBSTFILES += $(pkgdracut_SCRIPTS)
|
SUBSTFILES += $(pkgdracut_SCRIPTS)
|
||||||
|
|
|
@ -19,7 +19,6 @@ pkgdracut_DATA = \
|
||||||
zfs-rollback-bootfs.service
|
zfs-rollback-bootfs.service
|
||||||
|
|
||||||
SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA)
|
SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA)
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
||||||
# Provided by /bin/sleep, and, again, every implementation of that supports this
|
# Provided by /bin/sleep, and, again, every implementation of that supports this
|
||||||
CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.'
|
CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.'
|
||||||
|
|
|
@ -7,7 +7,6 @@ dist_initrd_SCRIPTS = \
|
||||||
|
|
||||||
SUBDIRS = conf.d conf-hooks.d hooks scripts
|
SUBDIRS = conf.d conf-hooks.d hooks scripts
|
||||||
SHELLCHECKDIRS = hooks scripts
|
SHELLCHECKDIRS = hooks scripts
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
README.initramfs.markdown
|
README.initramfs.markdown
|
||||||
|
|
|
@ -7,5 +7,4 @@ hooks_SCRIPTS = \
|
||||||
zfs \
|
zfs \
|
||||||
zfsunlock
|
zfsunlock
|
||||||
|
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
SUBSTFILES += $(hooks_SCRIPTS)
|
SUBSTFILES += $(hooks_SCRIPTS)
|
||||||
|
|
|
@ -9,4 +9,3 @@ SUBDIRS = local-top
|
||||||
|
|
||||||
SHELLCHECKDIRS = $(SUBDIRS)
|
SHELLCHECKDIRS = $(SUBDIRS)
|
||||||
SHELLCHECK_SHELL = sh
|
SHELLCHECK_SHELL = sh
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -5,4 +5,3 @@ localtopdir = /usr/share/initramfs-tools/scripts/local-top
|
||||||
dist_localtop_SCRIPTS = \
|
dist_localtop_SCRIPTS = \
|
||||||
zfs
|
zfs
|
||||||
|
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ include $(top_srcdir)/config/Shellcheck.am
|
||||||
|
|
||||||
SUBDIRS = zfs sudoers.d
|
SUBDIRS = zfs sudoers.d
|
||||||
SHELLCHECKDIRS = default $(ZFS_INIT_SYSV) zfs
|
SHELLCHECKDIRS = default $(ZFS_INIT_SYSV) zfs
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
||||||
if BUILD_LINUX
|
if BUILD_LINUX
|
||||||
SUBDIRS += default $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD)
|
SUBDIRS += default $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD)
|
||||||
|
|
|
@ -5,5 +5,4 @@ initconf_SCRIPTS = zfs
|
||||||
|
|
||||||
SUBSTFILES += $(initconf_SCRIPTS)
|
SUBSTFILES += $(initconf_SCRIPTS)
|
||||||
|
|
||||||
SHELLCHECK_SHELL = dash
|
SHELLCHECK_SHELL = sh
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -7,5 +7,4 @@ init_SCRIPTS = zfs-import zfs-load-key zfs-mount zfs-share zfs-zed
|
||||||
|
|
||||||
SUBSTFILES += $(init_SCRIPTS)
|
SUBSTFILES += $(init_SCRIPTS)
|
||||||
|
|
||||||
SHELLCHECK_SHELL = dash
|
SHELLCHECK_SHELL = sh
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
|
@ -15,5 +15,4 @@ pkgsysconf_SCRIPTS = \
|
||||||
|
|
||||||
SUBSTFILES += $(pkgsysconf_SCRIPTS)
|
SUBSTFILES += $(pkgsysconf_SCRIPTS)
|
||||||
|
|
||||||
SHELLCHECK_OPTS = --enable=all
|
SHELLCHECK_SHELL = sh
|
||||||
SHELLCHECK_SHELL = dash
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ EXTRA_DIST = \
|
||||||
$(EXTRA_SCRIPTS)
|
$(EXTRA_SCRIPTS)
|
||||||
|
|
||||||
SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
|
SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
|
||||||
SHELLCHECK_OPTS = --enable=all
|
|
||||||
|
|
||||||
define EXTRA_ENVIRONMENT
|
define EXTRA_ENVIRONMENT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue