Warn about bashism [^bar].
This commit is contained in:
parent
f85441add9
commit
f653362b18
|
@ -680,6 +680,7 @@ prop_checkBashisms23= verify checkBashisms "trap mything err int"
|
||||||
prop_checkBashisms24= verifyNot checkBashisms "trap mything int term"
|
prop_checkBashisms24= verifyNot checkBashisms "trap mything int term"
|
||||||
prop_checkBashisms25= verify checkBashisms "cat < /dev/tcp/host/123"
|
prop_checkBashisms25= verify checkBashisms "cat < /dev/tcp/host/123"
|
||||||
prop_checkBashisms26= verify checkBashisms "trap mything ERR SIGTERM"
|
prop_checkBashisms26= verify checkBashisms "trap mything ERR SIGTERM"
|
||||||
|
prop_checkBashisms27= verify checkBashisms "echo *[^0-9]*"
|
||||||
checkBashisms _ = bashism
|
checkBashisms _ = bashism
|
||||||
where
|
where
|
||||||
errMsg id s = err id 2040 $ "In sh, " ++ s ++ " not supported, even when sh is actually bash."
|
errMsg id s = err id 2040 $ "In sh, " ++ s ++ " not supported, even when sh is actually bash."
|
||||||
|
@ -710,6 +711,8 @@ checkBashisms _ = bashism
|
||||||
where
|
where
|
||||||
file = onlyLiteralString word
|
file = onlyLiteralString word
|
||||||
isNetworked = any (`isPrefixOf` file) ["/dev/tcp", "/dev/udp"]
|
isNetworked = any (`isPrefixOf` file) ["/dev/tcp", "/dev/udp"]
|
||||||
|
bashism (T_Glob id str) | "[^" `isInfixOf` str =
|
||||||
|
warnMsg id "^ in place of ! in glob bracket expressions is"
|
||||||
|
|
||||||
bashism t@(TA_Expansion id _) | isBashism =
|
bashism t@(TA_Expansion id _) | isBashism =
|
||||||
warnMsg id $ fromJust str ++ " is"
|
warnMsg id $ fromJust str ++ " is"
|
||||||
|
|
Loading…
Reference in New Issue