From e679ff222a32b02e3e488f425d39664939b3de1b Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Fri, 30 Dec 2016 16:55:31 -0800 Subject: [PATCH] Warn when using deprecated egrep/fgrep. --- ShellCheck/Checks/Commands.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ShellCheck/Checks/Commands.hs b/ShellCheck/Checks/Commands.hs index ff61d63..b809eba 100644 --- a/ShellCheck/Checks/Commands.hs +++ b/ShellCheck/Checks/Commands.hs @@ -83,6 +83,8 @@ commandChecks = [ ,checkTimedCommand ,checkLocalScope ,checkDeprecatedTempfile + ,checkDeprecatedEgrep + ,checkDeprecatedFgrep ] buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis) @@ -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 }) ) |])