Don't warn about expr if using : operator

This commit is contained in:
Vidar Holen 2013-11-03 13:47:04 -08:00
parent c343217fd2
commit 8d265aa25e
1 changed files with 3 additions and 1 deletions

View File

@ -312,7 +312,9 @@ checkUuoc _ = return ()
prop_checkNeedlessCommands = verify checkNeedlessCommands "foo=$(expr 3 + 2)" prop_checkNeedlessCommands = verify checkNeedlessCommands "foo=$(expr 3 + 2)"
prop_checkNeedlessCommands2 = verify checkNeedlessCommands "foo=`echo \\`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 [[ ]]." style id "expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]."
checkNeedlessCommands _ = return () checkNeedlessCommands _ = return ()