False positive SC2034: Variable incorrectly marked as unused inside indented here-document
Closed this issue · 1 comments
paskozdilar commented
For bugs
- Rule Id (if any, e.g. SC1000): SC2034
- My shellcheck version (
shellcheck --versionor 'online'): online - I tried on shellcheck.net and verified that this is still a problem on the latest commit
- It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue
For new checks and feature suggestions
- shellcheck.net (i.e. the latest commit) currently gives no useful warnings about this
- I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
function main() {
local FOO=bar
sed 's/^ EOF//' <<- ' EOF'
I am now using the variable: ${FOO}
EOF
}Here's what shellcheck currently says:
Line 4 SC2034: FOO appears unused. Verify use (or export if used externally).
Here's what I wanted or expected to see:
Nothing.
paskozdilar commented
Nevermind, the variable is actually not evaluated at all.
Shellcheck is actually correct.
Closing, sorry.