From 440d0038aaa3eacaf7bbb7b9bbe55b7c37663063 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Tue, 11 Feb 2020 01:03:10 -0500 Subject: [PATCH] Remove a partial pattern match equivalent to fromJust from checkFindNameGlob --- src/ShellCheck/Checks/Commands.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ShellCheck/Checks/Commands.hs b/src/ShellCheck/Checks/Commands.hs index 3beca25..f8f3a20 100644 --- a/src/ShellCheck/Checks/Commands.hs +++ b/src/ShellCheck/Checks/Commands.hs @@ -197,13 +197,11 @@ prop_checkFindNameGlob1 = verify checkFindNameGlob "find / -name *.php" prop_checkFindNameGlob2 = verify checkFindNameGlob "find / -type f -ipath *(foo)" prop_checkFindNameGlob3 = verifyNot checkFindNameGlob "find * -name '*.php'" checkFindNameGlob = CommandCheck (Basename "find") (f . arguments) where - acceptsGlob (Just s) = s `elem` [ "-ilname", "-iname", "-ipath", "-iregex", "-iwholename", "-lname", "-name", "-path", "-regex", "-wholename" ] - acceptsGlob _ = False + acceptsGlob s = s `elem` [ "-ilname", "-iname", "-ipath", "-iregex", "-iwholename", "-lname", "-name", "-path", "-regex", "-wholename" ] f [] = return () f [x] = return () f (a:b:r) = do - when (acceptsGlob (getLiteralString a) && isGlob b) $ do - let (Just s) = getLiteralString a + forM_ (getLiteralString a) $ \s -> when (acceptsGlob s && isGlob b) $ warn (getId b) 2061 $ "Quote the parameter to " ++ s ++ " so the shell won't interpret it." f (b:r)