mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-30 19:40:40 -07:00
Warn about unquoted expansions in arrays.
This commit is contained in:
parent
8e5e77ad76
commit
3c75674b50
2 changed files with 55 additions and 15 deletions
|
@ -722,6 +722,21 @@ filterByAnnotation token =
|
|||
parents = getParentTree token
|
||||
getCode (TokenComment _ (Comment _ c _)) = c
|
||||
|
||||
-- Is this a ${#anything}, to get string length or array count?
|
||||
isCountingReference (T_DollarBraced id token) =
|
||||
case concat $ oversimplify token of
|
||||
'#':_ -> True
|
||||
_ -> False
|
||||
isCountingReference _ = False
|
||||
|
||||
-- FIXME: doesn't handle ${a:+$var} vs ${a:+"$var"}
|
||||
isQuotedAlternativeReference t =
|
||||
case t of
|
||||
T_DollarBraced _ _ ->
|
||||
":+" `isInfixOf` bracedString t
|
||||
_ -> False
|
||||
|
||||
|
||||
|
||||
return []
|
||||
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue