mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 06:12:59 +08:00
Don't warn when line starts with &> (fixes #2281)
This commit is contained in:
@@ -1996,12 +1996,14 @@ readHereString = called "here string" $ do
|
|||||||
word <- readNormalWord
|
word <- readNormalWord
|
||||||
return $ T_HereString id word
|
return $ T_HereString id word
|
||||||
|
|
||||||
|
prop_readNewlineList1 = isOk readScript "&> /dev/null echo foo"
|
||||||
readNewlineList =
|
readNewlineList =
|
||||||
many1 ((linefeed <|> carriageReturn) `thenSkip` spacing) <* checkBadBreak
|
many1 ((linefeed <|> carriageReturn) `thenSkip` spacing) <* checkBadBreak
|
||||||
where
|
where
|
||||||
checkBadBreak = optional $ do
|
checkBadBreak = optional $ do
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
try $ lookAhead (oneOf "|&") -- See if the next thing could be |, || or &&
|
try $ lookAhead (oneOf "|&") -- See if the next thing could be |, || or &&
|
||||||
|
notFollowedBy2 (string "&>") -- Except &> or &>> which is valid
|
||||||
parseProblemAt pos ErrorC 1133
|
parseProblemAt pos ErrorC 1133
|
||||||
"Unexpected start of line. If breaking lines, |/||/&& should be at the end of the previous one."
|
"Unexpected start of line. If breaking lines, |/||/&& should be at the end of the previous one."
|
||||||
readLineBreak = optional readNewlineList
|
readLineBreak = optional readNewlineList
|
||||||
|
Reference in New Issue
Block a user