From 8d265aa25e13b592ba4d08113286964bb2e8bae2 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sun, 3 Nov 2013 13:47:04 -0800 Subject: [PATCH] Don't warn about expr if using : operator --- ShellCheck/Analytics.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index 2ebeb73..7e511a3 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -312,7 +312,9 @@ checkUuoc _ = return () prop_checkNeedlessCommands = verify checkNeedlessCommands "foo=$(expr 3 + 2)" prop_checkNeedlessCommands2 = verify checkNeedlessCommands "foo=`echo \\`expr 3 + 2\\``" -checkNeedlessCommands (T_SimpleCommand id _ (w:_)) | w `isCommand` "expr" = +prop_checkNeedlessCommands3 = verifyNot checkNeedlessCommands "foo=$(expr foo : regex)" +checkNeedlessCommands cmd@(T_SimpleCommand id _ (w:_)) | + w `isCommand` "expr" && (not $ ":" `elem` deadSimple cmd) = style id "expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]." checkNeedlessCommands _ = return ()