-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Single-quoted solitary item in for loop spuriously triggers SC2041 but not SC2043 #2891
Comments
That word doesn't require quotes anyway so... maybe it's just guessing that it's a command-in-a-string for some reason. Erroneous if so. This is just silly and hopefully not the actual rationale. There are several noisy and not super useful single-quoting warnings similar to this - where it tries to guess that the content of a single-quoted word was supposed to be something else. |
This is indeed quite annoying, especially when auto-generating scripts, see nix-community/disko#868 In my case, it's also purely about strings that all start with |
Regression introduced in 94bc0f5, because I developed against unstable, which has NixOS/nixpkgs#333744 merged, while 24.05 doesn't. Partly shellchecks mistake, see koalaman/shellcheck#2891 but whatever, we can't do much more about it than ignore the warning. Fixes #868
Regression introduced in 94bc0f5, because I developed against unstable, which has NixOS/nixpkgs#333744 merged, while 24.05 doesn't. Partly shellchecks mistake, see koalaman/shellcheck#2891 but whatever, we can't do much more about it than ignore the warning. Fixes #868
For bugs
shellcheck --version
or 'online'): onlineFor new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
I would not expect this to warn about SC2041, but SC2043. The following snippet where a second single-quoted element is iterated over does not warn about SC2041 (and, correctly, not about SC2043):
and neither does the following with double quotes (it does warn about SC2043, as expected):
The text was updated successfully, but these errors were encountered: