SC2256: Check for translated strings matching known variables

SC2247 already warns about translated strings that look like $"(foo)" or
$"{foo}".  Since typical use of translated strings is to translate whole
messages, a string like $"foo" is likely to be a similar mistake if foo
is the name of an existing variable.  Conversely, a string like
$"foo bar" is potentially meant to be a message id even if foo is a
known variable.

Add a warning for the $"foo" case, but make it separate from the
existing warning so that projects that reuse variable names as their
message ids can separately disable the new warning.
This commit is contained in:
Benjamin Gordon
2019-11-13 15:50:21 -07:00
parent 93eca1cb8e
commit 2341a4c683
2 changed files with 20 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
### Added
- SC2254: Suggest quoting expansions in case statements
- SC2255: Suggest using `$((..))` in `[ 2*3 -eq 6 ]`
- SC2256: Warn about translated strings that are known variables
## v0.7.0 - 2019-07-28
### Added