mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-28 07:19:58 +08:00
@@ -520,7 +520,7 @@ readConditionContents single =
|
|||||||
notFollowedBy2 (try (spacing >> string "]"))
|
notFollowedBy2 (try (spacing >> string "]"))
|
||||||
x <- readNormalWord
|
x <- readNormalWord
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
when (endedWith "]" x) $ do
|
when (endedWith "]" x && notArrayIndex x) $ do
|
||||||
parseProblemAt pos ErrorC 1020 $
|
parseProblemAt pos ErrorC 1020 $
|
||||||
"You need a space before the " ++ (if single then "]" else "]]") ++ "."
|
"You need a space before the " ++ (if single then "]" else "]]") ++ "."
|
||||||
fail "Missing space before ]"
|
fail "Missing space before ]"
|
||||||
@@ -534,6 +534,8 @@ readConditionContents single =
|
|||||||
case last s of T_Literal id s -> str `isSuffixOf` s
|
case last s of T_Literal id s -> str `isSuffixOf` s
|
||||||
_ -> False
|
_ -> False
|
||||||
endedWith _ _ = False
|
endedWith _ _ = False
|
||||||
|
notArrayIndex (T_NormalWord id s@(_:T_Literal _ t:_)) = t /= "["
|
||||||
|
notArrayIndex _ = True
|
||||||
|
|
||||||
readCondAndOp = readAndOrOp TC_And "&&" False <|> readAndOrOp TC_And "-a" True
|
readCondAndOp = readAndOrOp TC_And "&&" False <|> readAndOrOp TC_And "-a" True
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user