mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-09-22 03:45:41 +08:00
Removed warning for ~ in the middle of strings. Too common.
This commit is contained in:
@@ -1108,16 +1108,13 @@ checkInexplicablyUnquoted _ = return ()
|
|||||||
|
|
||||||
prop_checkTildeInQuotes1 = verify checkTildeInQuotes "var=\"~/out.txt\""
|
prop_checkTildeInQuotes1 = verify checkTildeInQuotes "var=\"~/out.txt\""
|
||||||
prop_checkTildeInQuotes2 = verify checkTildeInQuotes "foo > '~/dir'"
|
prop_checkTildeInQuotes2 = verify checkTildeInQuotes "foo > '~/dir'"
|
||||||
prop_checkTildeInQuotes3 = verify checkTildeInQuotes "args='-s ~/dir'"
|
|
||||||
prop_checkTildeInQuotes4 = verifyNot checkTildeInQuotes "~/file"
|
prop_checkTildeInQuotes4 = verifyNot checkTildeInQuotes "~/file"
|
||||||
prop_checkTildeInQuotes5 = verifyNot checkTildeInQuotes "echo '/~foo/cow'"
|
prop_checkTildeInQuotes5 = verifyNot checkTildeInQuotes "echo '/~foo/cow'"
|
||||||
|
prop_checkTildeInQuotes6 = verifyNot checkTildeInQuotes "awk '$0 ~ /foo/'"
|
||||||
checkTildeInQuotes = check
|
checkTildeInQuotes = check
|
||||||
where
|
where
|
||||||
post f = f "Note that ~ does not expand in quotes"
|
verify id ('~':_) = warn id "Note that ~ does not expand in quotes."
|
||||||
verify id ('~':_) = post (warn id)
|
verify _ _ = return ()
|
||||||
verify id str =
|
|
||||||
when (isJust $ matchRegex re str) $ post (info id)
|
|
||||||
re = mkRegex "\\s~"
|
|
||||||
check (T_NormalWord _ ((T_SingleQuoted id str):_)) =
|
check (T_NormalWord _ ((T_SingleQuoted id str):_)) =
|
||||||
verify id str
|
verify id str
|
||||||
check (T_NormalWord _ ((T_DoubleQuoted _ ((T_Literal id str):_)):_)) =
|
check (T_NormalWord _ ((T_DoubleQuoted _ ((T_Literal id str):_)):_)) =
|
||||||
|
Reference in New Issue
Block a user