mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 13:31:36 -07:00
Added warning for empty do clauses
This commit is contained in:
parent
389d5588d8
commit
844a07afa0
1 changed files with 4 additions and 0 deletions
|
@ -1130,6 +1130,10 @@ readDoGroup loopPos = do
|
||||||
acceptButWarn g_Semi ErrorC "No semicolons directly after 'do'."
|
acceptButWarn g_Semi ErrorC "No semicolons directly after 'do'."
|
||||||
allspacing
|
allspacing
|
||||||
|
|
||||||
|
optional (do
|
||||||
|
try . lookAhead $ g_Done
|
||||||
|
parseProblemAt loopPos ErrorC "Can't have empty do clauses (use 'true' as a no-op).")
|
||||||
|
|
||||||
commands <- readCompoundList
|
commands <- readCompoundList
|
||||||
g_Done `orFail` do
|
g_Done `orFail` do
|
||||||
parseProblemAt pos ErrorC "Couldn't find 'done' for this 'do'."
|
parseProblemAt pos ErrorC "Couldn't find 'done' for this 'do'."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue