Added -or and -print0 to SC2146
This commit is contained in:
parent
2814572116
commit
eccb9f3f71
|
@ -2989,14 +2989,14 @@ prop_checkFindActionPrecedence2 = verifyNot checkFindActionPrecedence "find . -n
|
||||||
prop_checkFindActionPrecedence3 = verifyNot checkFindActionPrecedence "find . -name '*.wav' -o -name '*.au'"
|
prop_checkFindActionPrecedence3 = verifyNot checkFindActionPrecedence "find . -name '*.wav' -o -name '*.au'"
|
||||||
checkFindActionPrecedence params = checkCommand "find" (const f)
|
checkFindActionPrecedence params = checkCommand "find" (const f)
|
||||||
where
|
where
|
||||||
pattern = [isMatch, const True, isParam ["-o"], isMatch, const True, isAction]
|
pattern = [isMatch, const True, isParam ["-o", "-or"], isMatch, const True, isAction]
|
||||||
f list | length list < length pattern = return ()
|
f list | length list < length pattern = return ()
|
||||||
f list@(_:rest) =
|
f list@(_:rest) =
|
||||||
if all id (zipWith ($) pattern list)
|
if all id (zipWith ($) pattern list)
|
||||||
then warnFor (list !! ((length pattern)-1))
|
then warnFor (list !! ((length pattern)-1))
|
||||||
else f rest
|
else f rest
|
||||||
isMatch = isParam [ "-name", "-regex", "-iname", "-iregex" ]
|
isMatch = isParam [ "-name", "-regex", "-iname", "-iregex", "-wholename", "-iwholename" ]
|
||||||
isAction = isParam [ "-exec", "-execdir", "-delete", "-print" ]
|
isAction = isParam [ "-exec", "-execdir", "-delete", "-print", "-print0" ]
|
||||||
isParam strs t = fromMaybe False $ do
|
isParam strs t = fromMaybe False $ do
|
||||||
param <- getLiteralString t
|
param <- getLiteralString t
|
||||||
return $ param `elem` strs
|
return $ param `elem` strs
|
||||||
|
|
Loading…
Reference in New Issue