From d00ca0c2835f0abc92cced9780f53810fe3765c6 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 5 Dec 2015 17:29:06 -0800 Subject: [PATCH] Fix/generalize message for SC2070. --- ShellCheck/Analytics.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index f32ef7b..1234b50 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -1153,8 +1153,9 @@ checkSingleQuotedVariables _ _ = return () prop_checkUnquotedN = verify checkUnquotedN "if [ -n $foo ]; then echo cow; fi" prop_checkUnquotedN2 = verify checkUnquotedN "[ -n $cow ]" prop_checkUnquotedN3 = verifyNot checkUnquotedN "[[ -n $foo ]] && echo cow" -checkUnquotedN _ (T_Condition _ SingleBracket (TC_Unary _ SingleBracket "-n" (T_NormalWord id [t]))) | willSplit t = - err id 2070 "Always true because you failed to quote. Use [[ ]] instead." +prop_checkUnquotedN4 = verify checkUnquotedN "[ -n $cow -o -t 1 ]" +checkUnquotedN _ (TC_Unary _ SingleBracket "-n" (T_NormalWord id [t])) | willSplit t = + err id 2070 "-n doesn't work with unquoted arguments. Quote or use [[ ]]." checkUnquotedN _ _ = return () prop_checkNumberComparisons1 = verify checkNumberComparisons "[[ $foo < 3 ]]"