multiple spurious warnings for zsh path modifications
#### For bugs with existing features
- Rule Id (if any, e.g. SC1000): SC2128 and SC2206
- My shellcheck version (`shellcheck --version` or "online"): 0.11.0
- [x] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
- [x] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit
#### Here's a snippet or screenshot that shows the problem:
```zsh
typeset -Uga path
path=(
$path
~/src/github.com/BelaPlatform/Bela/scripts
)
```
#### Here's what shellcheck currently says:
```txt
In src/.zshenv.d/bela.zsh line 3:
$path
^---^ SC2128 (warning): Expanding an array without an index only gives the first element.
^---^ SC2206 (warning): Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
For more information:
https://www.shellcheck.net/wiki/SC2128 -- Expanding an array without an ind...
https://www.shellcheck.net/wiki/SC2206 -- Quote to prevent word splitting/g...
```
#### Here's what I wanted or expected to see:
Nothing. The `path` variable in zsh is commonly `typeset -U[ga]`, often in external scripts from the one that ShellCheck is currently scanning (this script gets sourced). Enabling implicit, safe expansion in parentheses `(` ... `)`.
0 条评论