From 8c1ab0c9b69df802b0992b7f43528b84b0b44896 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 1 Dec 2012 13:19:40 -0800 Subject: [PATCH] Fixed warning for tr abc '[d*]' --- ShellCheck/Analytics.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index 8e43f67..7e5b2da 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -583,6 +583,7 @@ prop_checkTr6 = verify checkTr "tr 'hello' 'world'" prop_checkTr8 = verifyNot checkTr "tr aeiou _____" prop_checkTr9 = verifyNot checkTr "a-z n-za-m" prop_checkTr10= verifyNot checkTr "tr --squeeze-repeats rl lr" +prop_checkTr11= verifyNot checkTr "tr abc '[d*]'" checkTr = checkCommand "tr" (mapM_ f) where f w | isGlob w = do -- The user will go [ab] -> '[ab]' -> 'ab'. Fixme? @@ -596,7 +597,7 @@ checkTr = checkCommand "tr" (mapM_ f) info (getId word) "tr replaces sets of chars, not words (mentioned due to duplicates)." unless ("[:" `isPrefixOf` s) $ - when ("[" `isPrefixOf` s && "]" `isSuffixOf` s && (length s > 2)) $ + when ("[" `isPrefixOf` s && "]" `isSuffixOf` s && (length s > 2) && (not $ '*' `elem` s)) $ info (getId word) "Don't use [] around ranges in tr, it replaces literal square brackets." Nothing -> return ()