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:
Benjamin Gordon
2019-05-14 10:54:56 -06:00
committed by Benjamin Gordon
parent aa3b709b5d
commit 64c9c83cc8
3 changed files with 33 additions and 3 deletions

View File

@@ -8,12 +8,13 @@
- Source paths: Use `-P dir1:dir2` or a `source-path=dir1` directive
to specify search paths for sourced files.
- json1 format like --format=json but treats tabs as single characters
- SC2249: Warn about `case` with missing default case (verbose)
- SC2248: Warn about unquoted variables without special chars (verbose)
- SC2250: Warn about variable references without braces (optional)
- SC2249: Warn about `case` with missing default case (optional)
- SC2248: Warn about unquoted variables without special chars (optional)
- SC2247: Warn about $"(cmd)" and $"{var}"
- SC2246: Warn if a shebang's interpreter ends with /
- SC2245: Warn that Ksh ignores all but the first glob result in `[`
- SC2243/SC2244: Suggest using explicit -n for `[ $foo ]` (verbose)
- SC2243/SC2244: Suggest using explicit -n for `[ $foo ]` (optional)
### Changed
- If a directive or shebang is not specified, a `.bash/.bats/.dash/.ksh`