mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-07 20:23:03 +08:00
Improved messages for missing spaces in [..]
This commit is contained in:
@@ -268,8 +268,6 @@ readConditionContents single = do
|
|||||||
x <- readNormalWord
|
x <- readNormalWord
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
when (endedWith "]" x) $ do
|
when (endedWith "]" x) $ do
|
||||||
lookAhead (try $
|
|
||||||
(many whitespace) >> (eof <|> disregard readSeparator <|> disregard (g_Then <|> g_Do)))
|
|
||||||
parseProblemAt pos ErrorC $
|
parseProblemAt pos ErrorC $
|
||||||
"You need a space before the " ++ (if single then "]" else "]]") ++ "."
|
"You need a space before the " ++ (if single then "]" else "]]") ++ "."
|
||||||
when (single && endedWith ")" x) $ do
|
when (single && endedWith ")" x) $ do
|
||||||
@@ -305,8 +303,8 @@ readConditionContents single = do
|
|||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
lookAhead (char '[')
|
lookAhead (char '[')
|
||||||
parseProblemAt pos ErrorC $ if single
|
parseProblemAt pos ErrorC $ if single
|
||||||
then "Don't use [] for grouping. Use \\( .. \\)."
|
then "If grouping expressions inside [..], use \\( ..\\)."
|
||||||
else "Don't use [] for grouping. Use ()."
|
else "If grouping expressions inside [[..]], use ( .. )."
|
||||||
)
|
)
|
||||||
(do
|
(do
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
|
Reference in New Issue
Block a user