Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local variable escaped from the function #3044

Open
1 of 4 tasks
A4-Tacks opened this issue Aug 25, 2024 · 0 comments
Open
1 of 4 tasks

Local variable escaped from the function #3044

A4-Tacks opened this issue Aug 25, 2024 · 0 comments

Comments

@A4-Tacks
Copy link

A4-Tacks commented Aug 25, 2024

For bugs

  • Rule Id: SC2154
  • My shellcheck version:
    ShellCheck - shell script analysis tool
    version: 0.9.0
    license: GNU General Public License, version 3
    website: https://www.shellcheck.net
  • The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

#!/bin/bash
f() {
    local x=
}
echo "$x"

Here's what shellcheck currently says:

Here's what I wanted or expected to see:

In - line 5:
echo "$x"
      ^-- SC2154 (warning): x is referenced but not assigned.

For more information:
  https://www.shellcheck.net/wiki/SC2154 -- x is referenced but not assigned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant