fixing a bug of hlint options.

This commit is contained in:
Kazu Yamamoto 2014-03-28 15:03:41 +09:00
parent 7c0f2511d0
commit 7fa3736bac

View File

@ -159,9 +159,11 @@ lintStx set (LineSeparator lsep) optFile = liftIO $ E.handle handler $ do
return (msgs, True, set)
where
(opt,file) = parseLintOptions optFile
hopts = read opt
hopts = if opt == "" then [] else read opt
-- let's continue the session
handler (SomeException _) = return ([], True, set)
handler (SomeException e) = do
print e
return ([], True, set)
-- |
-- >>> parseLintOptions "[\"--ignore=Use camelCase\", \"--ignore=Eta reduce\"] file name"
@ -171,7 +173,7 @@ lintStx set (LineSeparator lsep) optFile = liftIO $ E.handle handler $ do
parseLintOptions :: String -> (String, String)
parseLintOptions optFile = case brk (== ']') (dropWhile (/= '[') optFile) of
("","") -> ([], optFile)
(opt',file') -> (opt', dropWhile (/= ' ') file')
(opt',file') -> (opt', dropWhile (== ' ') file')
where
brk _ [] = ([],[])
brk p (x:xs')