Skip to content

Commit

Permalink
Warn when using deprecated egrep/fgrep.
Browse files Browse the repository at this point in the history
  • Loading branch information
koalaman committed Dec 31, 2016
1 parent 30e94ea commit e679ff2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ShellCheck/Checks/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ commandChecks = [
,checkTimedCommand
,checkLocalScope
,checkDeprecatedTempfile
,checkDeprecatedEgrep
,checkDeprecatedFgrep
]

buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis)
Expand Down Expand Up @@ -667,5 +669,13 @@ prop_checkDeprecatedTempfile2 = verifyNot checkDeprecatedTempfile "tempfile=$(mk
checkDeprecatedTempfile = CommandCheck (Basename "tempfile") $
\t -> warn (getId t) 2186 "tempfile is deprecated. Use mktemp instead."

prop_checkDeprecatedEgrep = verify checkDeprecatedEgrep "egrep '.+'"
checkDeprecatedEgrep = CommandCheck (Basename "egrep") $
\t -> info (getId t) 2196 "egrep is non-standard and deprecated. Use grep -E instead."

prop_checkDeprecatedFgrep = verify checkDeprecatedFgrep "fgrep '*' files"
checkDeprecatedFgrep = CommandCheck (Basename "fgrep") $
\t -> info (getId t) 2197 "fgrep is non-standard and deprecated. Use grep -F instead."

return []
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])

0 comments on commit e679ff2

Please sign in to comment.