From cf1c46d852a4b489b43c5f9123b15ee5bc1e4d33 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 10 Dec 2016 09:58:27 -0800 Subject: [PATCH] Add deprecation warning for tempfile --- ShellCheck/Checks/Commands.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ShellCheck/Checks/Commands.hs b/ShellCheck/Checks/Commands.hs index e51f794..64d73da 100644 --- a/ShellCheck/Checks/Commands.hs +++ b/ShellCheck/Checks/Commands.hs @@ -82,6 +82,7 @@ commandChecks = [ ,checkTimeParameters ,checkTimedCommand ,checkLocalScope + ,checkDeprecatedTempfile ] buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis) @@ -659,5 +660,10 @@ checkLocalScope = CommandCheck (Exactly "local") $ \t -> unless (any isFunction path) $ err (getId t) 2168 "'local' is only valid in functions." +prop_checkDeprecatedTempfile1 = verify checkDeprecatedTempfile "var=$(tempfile)" +prop_checkDeprecatedTempfile2 = verifyNot checkDeprecatedTempfile "tempfile=$(mktemp)" +checkDeprecatedTempfile = CommandCheck (Basename "tempfile") $ + \t -> warn (getId t) 2186 "tempfile is deprecated. Use mktemp instead." + return [] runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])