Warn for test n > 4
This commit is contained in:
parent
ce0b313b93
commit
10d4abf235
|
@ -81,6 +81,7 @@ basicChecks = [
|
||||||
,checkValidCondOps
|
,checkValidCondOps
|
||||||
,checkGlobbedRegex
|
,checkGlobbedRegex
|
||||||
,checkTrapQuotes
|
,checkTrapQuotes
|
||||||
|
,checkTestRedirects
|
||||||
]
|
]
|
||||||
treeChecks = [
|
treeChecks = [
|
||||||
checkUnquotedExpansions
|
checkUnquotedExpansions
|
||||||
|
@ -850,6 +851,12 @@ checkTrapQuotes = checkCommand "trap" f where
|
||||||
checkExpansions (T_DollarArithmetic id _) = warning id
|
checkExpansions (T_DollarArithmetic id _) = warning id
|
||||||
checkExpansions _ = return ()
|
checkExpansions _ = return ()
|
||||||
|
|
||||||
|
prop_checkTestRedirects1 = verify checkTestRedirects "test 3 > 1"
|
||||||
|
prop_checkTestRedirects2 = verifyNot checkTestRedirects "test 3 \\> 1"
|
||||||
|
prop_checkTestRedirects3 = verify checkTestRedirects "/usr/bin/test $var > $foo"
|
||||||
|
checkTestRedirects (T_Redirecting id redirs@(redir:_) cmd) | cmd `isCommand` "test" =
|
||||||
|
warn (getId redir) $ "This is interpretted as a shell file redirection, not a comparison."
|
||||||
|
checkTestRedirects _ = return ()
|
||||||
|
|
||||||
--- Subshell detection
|
--- Subshell detection
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue