From 0c66cfb9361b1963b1101837d7ce0a87f07740a9 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Wed, 23 Jan 2013 17:15:55 -0800 Subject: [PATCH] Add warnings for empty then clauses --- ShellCheck/Parser.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index d0ff08b..5b2a080 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -1063,6 +1063,12 @@ readIfPart = do acceptButWarn g_Semi ErrorC "No semicolons directly after 'then'." allspacing + + optional (do + emptyPos <- getPosition + try . lookAhead $ (g_Fi <|> g_Elif) + parseProblemAt emptyPos ErrorC "Can't have empty then clauses (use 'true' as a no-op).") + action <- readTerm return (condition, action)