Commit 95a2837f authored by Andrew Gibiansky's avatar Andrew Gibiansky

Not sending hlint messages where there are no suggestions.

parent 41816292
...@@ -161,7 +161,8 @@ evaluate kernelState code output = do ...@@ -161,7 +161,8 @@ evaluate kernelState code output = do
when (getLintStatus kernelState /= LintOff) $ liftIO $ do when (getLintStatus kernelState /= LintOff) $ liftIO $ do
lintSuggestions <- lint cmds lintSuggestions <- lint cmds
output True lintSuggestions unless (null lintSuggestions) $
output True lintSuggestions
updated <- runUntilFailure kernelState (map unloc cmds ++ [storeItCommand execCount]) updated <- runUntilFailure kernelState (map unloc cmds ++ [storeItCommand execCount])
return updated { return updated {
...@@ -670,4 +671,4 @@ formatGetType :: String -> String ...@@ -670,4 +671,4 @@ formatGetType :: String -> String
formatGetType = printf "<span style='font-weight: bold; color: green;'>%s</span>" formatGetType = printf "<span style='font-weight: bold; color: green;'>%s</span>"
displayError :: ErrMsg -> [DisplayData] displayError :: ErrMsg -> [DisplayData]
displayError msg = [plain msg, html $ formatError msg] displayError msg = [plain . typeCleaner $ msg, html $ formatError msg]
...@@ -44,7 +44,11 @@ lint blocks = do ...@@ -44,7 +44,11 @@ lint blocks = do
writeFile (fromString filename) fileContents writeFile (fromString filename) fileContents
suggestions <- catMaybes <$> map parseSuggestion <$> hlint [filename, "--quiet"] suggestions <- catMaybes <$> map parseSuggestion <$> hlint [filename, "--quiet"]
return [plain $ concatMap plainSuggestion suggestions, html $ htmlSuggestions suggestions] return $
if null suggestions
then []
else
[plain $ concatMap plainSuggestion suggestions, html $ htmlSuggestions suggestions]
where where
-- Join together multiple valid file blocks into a single file. -- Join together multiple valid file blocks into a single file.
-- However, join them with padding so that the line numbers are -- However, join them with padding so that the line numbers are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment