Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Found:
<br>
Suggestion:
<code>
Perhaps you should remove it.
You may be able to remove it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplifying to You can remove it was my immediate thought too, FWIW

</code>
<br>
</td>
Expand Down Expand Up @@ -1050,7 +1050,7 @@ do
<br>
Suggestion:
<code>
Perhaps you should remove it.
You may be able to remove it.
</code>
<br>
</td>
Expand Down Expand Up @@ -1319,7 +1319,7 @@ where
<br>
Suggestion:
<code>
Perhaps you should remove it.
You may be able to remove it.
</code>
<br>
Does not support refactoring.
Expand Down
9 changes: 5 additions & 4 deletions src/Idea.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 may be able to remove it."]
| otherwise = ("Perhaps" ++ ":") : map (" "++) xs
where xs = lines $ tt x


Expand Down
2 changes: 1 addition & 1 deletion src/Summary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ showBuiltin BuiltinHint{..} = row1
where
eTo' = case eTo of
Nothing -> ""
Just "" -> "Perhaps you should remove it."
Just "" -> "You may be able to remove it."
Just s -> s

lhsRhsTable :: [HintRule] -> [String]
Expand Down
6 changes: 3 additions & 3 deletions tests/hint.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ OUTPUT
tests/note.hs:1:1-32: Warning: Unused LANGUAGE pragma
Found:
{-# LANGUAGE RecordWildCards #-}
Perhaps you should remove it.
You may be able to remove it.
Note: may require `{-# LANGUAGE DisambiguateRecordFields #-}` adding to the top of the file

tests/note.hs:5:11-24: Suggestion: Use null
Expand Down Expand Up @@ -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 may be able to 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 may be able to remove it.
Note: Extension DeriveFunctor is implied by DeriveTraversable

tests/restricted-extension.hs:2:1-30: Warning: Avoid restricted extensions
Expand Down