Let checkGrepRe only parse flags once
This commit is contained in:
parent
26c55750cf
commit
baa4d2e555
|
@ -234,7 +234,7 @@ checkGrepRe = CommandCheck (Basename "grep") check where
|
||||||
when (isGlob re) $
|
when (isGlob re) $
|
||||||
warn (getId re) 2062 "Quote the grep pattern so the shell won't interpret it."
|
warn (getId re) 2062 "Quote the grep pattern so the shell won't interpret it."
|
||||||
|
|
||||||
unless (any (hasFlag cmd) grepGlobFlags) $ do
|
unless (any (`elem` flags) grepGlobFlags) $ do
|
||||||
let string = concat $ oversimplify re
|
let string = concat $ oversimplify re
|
||||||
if isConfusedGlobRegex string then
|
if isConfusedGlobRegex string then
|
||||||
warn (getId re) 2063 "Grep uses regex, but this looks like a glob."
|
warn (getId re) 2063 "Grep uses regex, but this looks like a glob."
|
||||||
|
@ -243,6 +243,7 @@ checkGrepRe = CommandCheck (Basename "grep") check where
|
||||||
return $ info (getId re) 2022 $
|
return $ info (getId re) 2022 $
|
||||||
"Note that unlike globs, " ++ [char] ++ "* here matches '" ++ [char, char, char] ++ "' but not '" ++ wordStartingWith char ++ "'."
|
"Note that unlike globs, " ++ [char] ++ "* here matches '" ++ [char, char, char] ++ "' but not '" ++ wordStartingWith char ++ "'."
|
||||||
where
|
where
|
||||||
|
flags = map snd $ getAllFlags cmd
|
||||||
grepGlobFlags = ["F", "include", "exclude", "exclude-dir"]
|
grepGlobFlags = ["F", "include", "exclude", "exclude-dir"]
|
||||||
|
|
||||||
wordStartingWith c =
|
wordStartingWith c =
|
||||||
|
|
Loading…
Reference in New Issue