mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 05:21:34 -07:00
SC2250: New optional check for braces around variable references
Always using braces makes it harder to accidentally change a variable by pasting other text next to it, but the warning is off by default because it's definitely a style preference. Omit special and positional variables from the check because appending additional characters to them already doesn't change parsing.
This commit is contained in:
parent
aa3b709b5d
commit
64c9c83cc8
3 changed files with 33 additions and 3 deletions
|
@ -49,6 +49,10 @@ variablesWithoutSpaces = specialVariablesWithoutSpaces ++ [
|
|||
|
||||
specialVariables = specialVariablesWithoutSpaces ++ ["@", "*"]
|
||||
|
||||
unbracedVariables = specialVariables ++ [
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
|
||||
]
|
||||
|
||||
arrayVariables = [
|
||||
"BASH_ALIASES", "BASH_ARGC", "BASH_ARGV", "BASH_CMDS", "BASH_LINENO",
|
||||
"BASH_REMATCH", "BASH_SOURCE", "BASH_VERSINFO", "COMP_WORDS", "COPROC",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue