Don't warn about uuoc for cat -n and similar.
This commit is contained in:
parent
136b654867
commit
ccb6bf1ed5
|
@ -454,12 +454,14 @@ prop_checkUuoc2 = verifyNot checkUuoc "cat * | grep bar"
|
||||||
prop_checkUuoc3 = verify checkUuoc "cat $var | grep bar"
|
prop_checkUuoc3 = verify checkUuoc "cat $var | grep bar"
|
||||||
prop_checkUuoc4 = verifyNot checkUuoc "cat $var"
|
prop_checkUuoc4 = verifyNot checkUuoc "cat $var"
|
||||||
prop_checkUuoc5 = verifyNot checkUuoc "cat \"$@\""
|
prop_checkUuoc5 = verifyNot checkUuoc "cat \"$@\""
|
||||||
|
prop_checkUuoc6 = verifyNot checkUuoc "cat -n | grep bar"
|
||||||
checkUuoc _ (T_Pipeline _ _ (T_Redirecting _ _ cmd:_:_)) =
|
checkUuoc _ (T_Pipeline _ _ (T_Redirecting _ _ cmd:_:_)) =
|
||||||
checkCommand "cat" (const f) cmd
|
checkCommand "cat" (const f) cmd
|
||||||
where
|
where
|
||||||
f [word] = unless (mayBecomeMultipleArgs word) $
|
f [word] = unless (mayBecomeMultipleArgs word || isOption word) $
|
||||||
style (getId word) 2002 "Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead."
|
style (getId word) 2002 "Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead."
|
||||||
f _ = return ()
|
f _ = return ()
|
||||||
|
isOption word = "-" `isPrefixOf` onlyLiteralString word
|
||||||
checkUuoc _ _ = return ()
|
checkUuoc _ _ = return ()
|
||||||
|
|
||||||
prop_checkNeedlessCommands = verify checkNeedlessCommands "foo=$(expr 3 + 2)"
|
prop_checkNeedlessCommands = verify checkNeedlessCommands "foo=$(expr 3 + 2)"
|
||||||
|
|
Loading…
Reference in New Issue