From 93eca1cb8e7e8c1428a1375e985a669b43c41e95 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sun, 3 Nov 2019 13:25:46 -0800 Subject: [PATCH] Only trigger SC1014 when command is a complete word (fixes #1737) --- src/ShellCheck/Parser.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 075d486..96822a3 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -437,6 +437,7 @@ readConditionContents single = readCondContents `attempting` lookAhead (do pos <- getPosition s <- readVariableName + spacing1 when (s `elem` commonCommands) $ parseProblemAt pos WarningC 1014 "Use 'if cmd; then ..' to check exit code, or 'if [[ $(cmd) == .. ]]' to check output.") @@ -911,6 +912,7 @@ prop_readCondition21 = isOk readCondition "[[ $1 =~ ^(a\\ b)$ ]]" prop_readCondition22 = isOk readCondition "[[ $1 =~ \\.a\\.(\\.b\\.)\\.c\\. ]]" prop_readCondition23 = isOk readCondition "[[ -v arr[$var] ]]" prop_readCondition24 = isWarning readCondition "[[ 1 == 2 ]]]" +prop_readCondition25 = isOk readCondition "[[ lex.yy.c -ot program.l ]]" readCondition = called "test expression" $ do opos <- getPosition start <- startSpan