-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
For bugs with existing features
- Rule Id (if any, e.g. SC1000): SC2248
- My shellcheck version (
shellcheck --versionor "online"): shellcheck (edge) v0.11.0+git57.29f0d8d - 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
It seems https://www.shellcheck.net/ doesn't use --enable=all
But I checked that latest snap (latest/edge) mentions the same commit hash
as the latest commit on GitHub.
Here's a snippet or screenshot that shows the problem:
#!/usr/bin/env bash
foo(){
declare -i cd_result
cd "$1" || {
cd_result=$?;
echo "foo no such directory";
return ${cd_result};
}
}Here's what shellcheck currently says:
shellcheck --enable=all truc.sh
In truc.sh line 7:
return ${cd_result};
^----------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters.
Did you mean:
return "${cd_result}";
For more information:
https://www.shellcheck.net/wiki/SC2248 -- Prefer double quoting even when v...
Here's what I wanted or expected to see:
I think the only valid exception to rule SC2248 is when the variable is declared as integer.
Script above is such a case,
and in my opinion there should be no warning in that case.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels