From 43f667a8f910e24500d66c4fabce64e6856080c6 Mon Sep 17 00:00:00 2001 From: Ekaterina Efimova Date: Tue, 3 Jan 2017 21:48:35 +0300 Subject: [PATCH] Update Analytics.hs --- ShellCheck/Analytics.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index f1be786..77a9e1c 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -334,6 +334,7 @@ prop_checkPipePitfalls12 = verifyNot checkPipePitfalls "foo | grep -o bar | wc - prop_checkPipePitfalls13 = verifyNot checkPipePitfalls "foo | grep bar | wc -c" prop_checkPipePitfalls14 = verifyNot checkPipePitfalls "foo | grep -o bar | wc -cmwL" prop_checkPipePitfalls15 = verifyNot checkPipePitfalls "foo | grep bar | wc -cmwL" +prop_checkPipePitfalls16 = verifyNot checkPipePitfalls "foo | grep -r bar | wc -l" checkPipePitfalls _ (T_Pipeline id _ commands) = do for ["find", "xargs"] $ \(find:xargs:_) -> @@ -358,7 +359,7 @@ checkPipePitfalls _ (T_Pipeline id _ commands) = do let flagsGrep = fromMaybe [] $ map snd <$> getAllFlags <$> getCommand grep flagsWc = fromMaybe [] $ map snd <$> getAllFlags <$> getCommand wc in - unless ((any (`elem` ["o", "only-matching"]) flagsGrep) || (any (`elem` ["m", "chars", "w", "words", "c", "bytes", "L", "max-line-length"]) flagsWc) || ((length flagsWc) == 0)) $ + unless ((any (`elem` ["o", "only-matching", "r", "R", "recursive"]) flagsGrep) || (any (`elem` ["m", "chars", "w", "words", "c", "bytes", "L", "max-line-length"]) flagsWc) || ((length flagsWc) == 0)) $ style (getId grep) 2126 "Consider using grep -c instead of grep|wc -l." didLs <- liftM or . sequence $ [