mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-09-23 04:19:45 +08:00
Allow #inline comments
without SC2046.
This commit is contained in:
@@ -774,16 +774,17 @@ prop_checkUnquotedExpansions5 = verifyNot checkUnquotedExpansions "for f in $(cm
|
|||||||
prop_checkUnquotedExpansions6 = verifyNot checkUnquotedExpansions "$(cmd)"
|
prop_checkUnquotedExpansions6 = verifyNot checkUnquotedExpansions "$(cmd)"
|
||||||
prop_checkUnquotedExpansions7 = verifyNot checkUnquotedExpansions "cat << foo\n$(ls)\nfoo"
|
prop_checkUnquotedExpansions7 = verifyNot checkUnquotedExpansions "cat << foo\n$(ls)\nfoo"
|
||||||
prop_checkUnquotedExpansions8 = verifyNot checkUnquotedExpansions "set -- $(seq 1 4)"
|
prop_checkUnquotedExpansions8 = verifyNot checkUnquotedExpansions "set -- $(seq 1 4)"
|
||||||
|
prop_checkUnquotedExpansions9 = verifyNot checkUnquotedExpansions "echo foo `# inline comment`"
|
||||||
checkUnquotedExpansions params =
|
checkUnquotedExpansions params =
|
||||||
check
|
check
|
||||||
where
|
where
|
||||||
check t@(T_DollarExpansion _ _) = examine t
|
check t@(T_DollarExpansion _ c) = examine t c
|
||||||
check t@(T_Backticked _ _) = examine t
|
check t@(T_Backticked _ c) = examine t c
|
||||||
check t@(T_DollarBraceCommandExpansion _ _) = examine t
|
check t@(T_DollarBraceCommandExpansion _ c) = examine t c
|
||||||
check _ = return ()
|
check _ = return ()
|
||||||
tree = parentMap params
|
tree = parentMap params
|
||||||
examine t =
|
examine t contents =
|
||||||
unless (shouldBeSplit t || isQuoteFree tree t || usedAsCommandName tree t) $
|
unless (null contents || shouldBeSplit t || isQuoteFree tree t || usedAsCommandName tree t) $
|
||||||
warn (getId t) 2046 "Quote this to prevent word splitting."
|
warn (getId t) 2046 "Quote this to prevent word splitting."
|
||||||
|
|
||||||
shouldBeSplit t =
|
shouldBeSplit t =
|
||||||
|
Reference in New Issue
Block a user