Here's a snippet or screenshot that shows the problem:
#!/bin/bash
ppArrInd() {
local -n args="$1"
printf '<%s>\n' "${args[@]}"
}
case "$1" in
0) main() {
local param=(foo bar)
ppArrInd param
};;
1) main() {
local param=(baz quz)
ppArrInd param
};;
*) main() {
local param=(fizz buzz)
ppArrInd param
};;
esac
main
Here's what shellcheck currently says:
SC2034 is triggered unless specifically it is disabled on the last definition of param
Here's what I wanted or expected to see:
Given that realizing that an array is passed by name is out-of-scope for SC2034, at least it should warn at each of the definition lines for param (either since it understands that these are distinct variables, or since "is later redefined" should not count as a usage -- I'd similarly expect x=1; x=2; x=3 to warn that each of these definitions of x are unused)
For bugs
shellcheck --version
or "online"): 0.10.0Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
SC2034
is triggered unless specifically it is disabled on the last definition ofparam
Here's what I wanted or expected to see:
Given that realizing that an array is passed by name is out-of-scope for
SC2034
, at least it should warn at each of the definition lines forparam
(either since it understands that these are distinct variables, or since "is later redefined" should not count as a usage -- I'd similarly expectx=1; x=2; x=3
to warn that each of these definitions ofx
are unused)