1cf67849c8
These are currently prone to false-positives especially in terms of
scoping. Consider the following:
foo() {
local bar=(42)
echo "${bar[*]}"
}
bar=43
foo
echo "$bar"
Some versions of shellcheck, including the latest, 0.7.2, complain
about $bar being reused as a plain string here. This is incorrect
since foo() holds its own copy of bar[@] hence the assignment which
takes place outside of it doesn't affect its content.
SC2178 can be mitigated be reversing the order of declaration:
bar=43
foo() { ... }
...
but the SC2128 still remains.
Currently, in our code majority of these warnings are coming from
false-positives due to initial source'ing which most of our test
scripts do (e.g. they fetch a function where local bar=() is used
and in the test itself $bar happens to be assigned a plain string.
This is still valid code).
To mitigate, disable these directives untill shellcheck is capable
of properly interpreting scoping when checking them.
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8503 (master)
(cherry-picked from commit
|
||
---|---|---|
.. | ||
bash-completion | ||
ceph | ||
perf | ||
pkgdep | ||
rpc | ||
spdkcli | ||
vagrant | ||
check_format.sh | ||
common.sh | ||
config_converter.py | ||
core-collector.sh | ||
detect_cc.sh | ||
dpdk_mem_info.py | ||
eofnl | ||
fio.py | ||
gdb_macros.py | ||
gen_ftl.sh | ||
gen_nvme.sh | ||
genconfig.py | ||
histogram.py | ||
iostat.py | ||
pc_libs.sh | ||
pc_modules.sh | ||
pc.sh | ||
pkgdep.sh | ||
posix.txt | ||
prep_benchmarks.sh | ||
qat_setup.sh | ||
rpc_http_proxy.py | ||
rpc.py | ||
rxe_cfg_small.sh | ||
setup.sh | ||
spdkcli.py | ||
sync_dev_uevents.sh |