test: Shellcheck - add rule SC2154 to exclude list
Corrected code in some files. Most of cases cannot be corrected as we use global variables defined in other files. SC2154: var is referenced but not assigned. Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Change-Id: Id333587f81b0bc2456b0c97bac5343a8e5a22774 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472342 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
074df1d896
commit
4d0c5091a9
@ -243,7 +243,7 @@ if hash shellcheck 2>/dev/null; then
|
||||
SHCK_EXCLUDE="SC1083,SC2002,\
|
||||
SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\
|
||||
SC2097,SC2098,SC2119,SC2120,SC2128,\
|
||||
SC2129,SC2140,SC2142,SC2143,SC2154"
|
||||
SC2129,SC2140,SC2142,SC2143"
|
||||
# SPDK fails some error checks which have been deprecated in later versions of shellcheck.
|
||||
# We will not try to fix these error checks, but instead just leave the error types here
|
||||
# so that we can still run with older versions of shellcheck.
|
||||
@ -255,13 +255,14 @@ SC2129,SC2140,SC2142,SC2143,SC2154"
|
||||
# SC2001: See if you can use ${variable//search/replace} instead.
|
||||
# SC2148: Add shebang to the top of your script.
|
||||
# SC2153: Possible Misspelling: MYVARIABLE may not be assigned, but MY_VARIABLE is.
|
||||
# SC2154: var is referenced but not assigned.
|
||||
# SC2164: Use cd ... || exit in case cd fails.
|
||||
# SC2174: When used with -p, -m only applies to the deepest directory.
|
||||
# SC2206: Quote to prevent word splitting/globbing,
|
||||
# or split robustly with mapfile or read -a.
|
||||
# SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
|
||||
# SC2223: This default assignment may cause DoS due to globbing. Quote it.
|
||||
SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1090,SC1091,SC2148,SC2153,SC2164,\
|
||||
SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1090,SC1091,SC2148,SC2153,SC2154,SC2164,\
|
||||
SC2174,SC2001,SC2206,SC2207,SC2223"
|
||||
|
||||
SHCK_FORMAT="diff"
|
||||
@ -270,7 +271,7 @@ SC2174,SC2001,SC2206,SC2207,SC2223"
|
||||
SHCK_FORMAT="tty"
|
||||
SHCK_APPLY=false
|
||||
fi
|
||||
SHCH_ARGS=" -e $SHCK_EXCLUDE -f $SHCK_FORMAT"
|
||||
SHCH_ARGS=" -x -e $SHCK_EXCLUDE -f $SHCK_FORMAT"
|
||||
|
||||
error=0
|
||||
git ls-files '*.sh' | xargs -P$(nproc) -n1 shellcheck $SHCH_ARGS &> shellcheck.log || error=1
|
||||
|
@ -598,7 +598,7 @@ function vm_setup()
|
||||
error "'--incoming' and '--migrate-to' cannot be used together"
|
||||
return 1
|
||||
elif [[ -n "$vm_incoming" ]]; then
|
||||
if [[ -n "$os_mode" || -n "$os_img" ]]; then
|
||||
if [[ -n "$os_mode" || -n "$os" ]]; then
|
||||
error "'--incoming' can't be used together with '--os' nor '--os-mode'"
|
||||
return 1
|
||||
fi
|
||||
|
@ -15,6 +15,7 @@ reuse_vms=false
|
||||
vms=()
|
||||
used_vms=""
|
||||
x=""
|
||||
readonly=""
|
||||
|
||||
function usage()
|
||||
{
|
||||
@ -39,6 +40,7 @@ function usage()
|
||||
echo " NUM - VM number (mandatory)"
|
||||
echo " OS - VM os disk path (optional)"
|
||||
echo " DISKS - VM os test disks/devices path (virtio - optional, kernel_vhost - mandatory)"
|
||||
echo " --readonly Use readonly for fio"
|
||||
exit 0
|
||||
}
|
||||
|
||||
@ -55,6 +57,7 @@ while getopts 'xh-:' optchar; do
|
||||
no-shutdown) no_shutdown=true ;;
|
||||
test-type=*) test_type="${OPTARG#*=}" ;;
|
||||
vm=*) vms+=("${OPTARG#*=}") ;;
|
||||
readonly) readonly="--readonly" ;;
|
||||
*) usage $0 "Invalid argument '$OPTARG'" ;;
|
||||
esac
|
||||
;;
|
||||
|
@ -15,6 +15,7 @@ disk_split=""
|
||||
x=""
|
||||
scsi_hot_remove_test=0
|
||||
blk_hot_remove_test=0
|
||||
readonly=""
|
||||
|
||||
|
||||
function usage() {
|
||||
@ -36,6 +37,7 @@ function usage() {
|
||||
echo " OS - VM os disk path (optional)"
|
||||
echo " DISKS - VM os test disks/devices path (virtio - optional, kernel_vhost - mandatory)"
|
||||
echo " --scsi-hotremove-test Run scsi hotremove tests"
|
||||
echo " --readonly Use readonly for fio"
|
||||
exit 0
|
||||
}
|
||||
|
||||
@ -50,6 +52,7 @@ while getopts 'xh-:' optchar; do
|
||||
vm=*) vms+=("${OPTARG#*=}") ;;
|
||||
scsi-hotremove-test) scsi_hot_remove_test=1 ;;
|
||||
blk-hotremove-test) blk_hot_remove_test=1 ;;
|
||||
readonly) readonly="--readonly" ;;
|
||||
*) usage $0 "Invalid argument '$OPTARG'" ;;
|
||||
esac
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user