You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a snippet or screenshot that shows the problem:
#!/bin/bashset -u
fn1() {
local foo=foo
echo"$foo"
}
fn2() {
echo"$foo"# foo is undefined here because it is local to fn1 and not called from fn1.
}
fn1
fn2
Here's what shellcheck currently says:
Nothing. :-(
Here's what I wanted or expected to see:
foo is not defined in fn2 because it was declared local in fn1 so ShellCheck should warn about this. I realize scoping is dynamic, not lexical but I think even a lexical analysis with a warning such as:
Line 11:
echo "$foo"
^-- SCXXXX: foo is referenced but may not be assigned.
Maybe related to #1497 and #1225. Possible dupe of #518.
The text was updated successfully, but these errors were encountered:
For bugs
shellcheck --version
or "online"): online and 0.6.0For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Nothing. :-(
Here's what I wanted or expected to see:
foo
is not defined infn2
because it was declared local infn1
so ShellCheck should warn about this. I realize scoping is dynamic, not lexical but I think even a lexical analysis with a warning such as:Maybe related to #1497 and #1225. Possible dupe of #518.
The text was updated successfully, but these errors were encountered: