Don't warn about quotes in variables for eval
This commit is contained in:
parent
1d2c7a8551
commit
4dca88aade
ShellCheck
|
@ -1722,6 +1722,7 @@ prop_checkQuotesInLiterals1a= verifyFull checkQuotesInLiterals "param=\"--foo='l
|
||||||
prop_checkQuotesInLiterals2 = verifyNotFull checkQuotesInLiterals "param='--foo=\"bar\"'; app \"$param\""
|
prop_checkQuotesInLiterals2 = verifyNotFull checkQuotesInLiterals "param='--foo=\"bar\"'; app \"$param\""
|
||||||
prop_checkQuotesInLiterals3 =verifyNotFull checkQuotesInLiterals "param=('--foo='); app \"${param[@]}\""
|
prop_checkQuotesInLiterals3 =verifyNotFull checkQuotesInLiterals "param=('--foo='); app \"${param[@]}\""
|
||||||
prop_checkQuotesInLiterals4 = verifyNotFull checkQuotesInLiterals "param=\"don't bother with this one\"; app $param"
|
prop_checkQuotesInLiterals4 = verifyNotFull checkQuotesInLiterals "param=\"don't bother with this one\"; app $param"
|
||||||
|
prop_checkQuotesInLiterals5 = verifyNotFull checkQuotesInLiterals "param=\"--foo='lolbar'\"; eval app $param"
|
||||||
checkQuotesInLiterals t =
|
checkQuotesInLiterals t =
|
||||||
doVariableFlowAnalysis readF writeF Map.empty t
|
doVariableFlowAnalysis readF writeF Map.empty t
|
||||||
where
|
where
|
||||||
|
@ -1743,7 +1744,9 @@ checkQuotesInLiterals t =
|
||||||
|
|
||||||
readF _ expr name = do
|
readF _ expr name = do
|
||||||
assignment <- getQuotes name
|
assignment <- getQuotes name
|
||||||
if isJust assignment && not (inUnquotableContext parents expr)
|
if isJust assignment
|
||||||
|
&& not (isParamTo parents "eval" expr)
|
||||||
|
&& not (inUnquotableContext parents expr)
|
||||||
then return [
|
then return [
|
||||||
(fromJust assignment,
|
(fromJust assignment,
|
||||||
Note WarningC 2089 "Word splitting will treat quotes as literals. Use an array."),
|
Note WarningC 2089 "Word splitting will treat quotes as literals. Use an array."),
|
||||||
|
|
Loading…
Reference in New Issue