diff --git a/hints.md b/hints.md index da06294a..c84b6dbe 100644 --- a/hints.md +++ b/hints.md @@ -249,7 +249,7 @@ Found:
Suggestion: -Perhaps you should remove it. +You can remove it.
@@ -1050,7 +1050,7 @@ do
Suggestion: -Perhaps you should remove it. +You can remove it.
@@ -1319,7 +1319,7 @@ where
Suggestion: -Perhaps you should remove it. +You can remove it.
Does not support refactoring. diff --git a/src/Idea.hs b/src/Idea.hs index e0267312..d94fb249 100644 --- a/src/Idea.hs +++ b/src/Idea.hs @@ -75,12 +75,13 @@ showIdeaANSI = showEx hsColourConsole showEx :: (String -> String) -> Idea -> String showEx tt Idea{..} = unlines $ [showSrcSpan ideaSpan ++ ": " ++ (if ideaHint == "" then "" else show ideaSeverity ++ ": " ++ ideaHint)] ++ - f "Found" (Just ideaFrom) ++ f "Perhaps" ideaTo ++ + f ideaFrom ++ maybe [] p ideaTo ++ ["Note: " ++ n | let n = showNotes ideaNote, n /= ""] where - f msg Nothing = [] - f msg (Just x) | null xs = [msg ++ " you should remove it."] - | otherwise = (msg ++ ":") : map (" "++) xs + f x = ("Found" ++ ":") : map (" "++) (lines (tt x)) + + p x | null xs = ["You can remove it."] + | otherwise = ("Perhaps" ++ ":") : map (" "++) xs where xs = lines $ tt x diff --git a/src/Summary.hs b/src/Summary.hs index 21d10dd3..33ea7186 100644 --- a/src/Summary.hs +++ b/src/Summary.hs @@ -177,7 +177,7 @@ showBuiltin BuiltinHint{..} = row1 where eTo' = case eTo of Nothing -> "" - Just "" -> "Perhaps you should remove it." + Just "" -> "You can remove it." Just s -> s lhsRhsTable :: [HintRule] -> [String] diff --git a/tests/hint.test b/tests/hint.test index 5296bfc5..33d64cc6 100644 --- a/tests/hint.test +++ b/tests/hint.test @@ -26,7 +26,7 @@ OUTPUT tests/note.hs:1:1-32: Warning: Unused LANGUAGE pragma Found: {-# LANGUAGE RecordWildCards #-} -Perhaps you should remove it. +You can remove it. Note: may require `{-# LANGUAGE DisambiguateRecordFields #-}` adding to the top of the file tests/note.hs:5:11-24: Suggestion: Use null @@ -219,13 +219,13 @@ OUTPUT tests/restricted-extension.hs:1:1-31: Warning: Unused LANGUAGE pragma Found: {-# LANGUAGE DeriveFoldable #-} -Perhaps you should remove it. +You can remove it. Note: Extension DeriveFoldable is implied by DeriveTraversable tests/restricted-extension.hs:2:1-30: Warning: Unused LANGUAGE pragma Found: {-# LANGUAGE DeriveFunctor #-} -Perhaps you should remove it. +You can remove it. Note: Extension DeriveFunctor is implied by DeriveTraversable tests/restricted-extension.hs:2:1-30: Warning: Avoid restricted extensions