Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amoral language #1591

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 can remove it.
</code>
<br>
</td>
Expand Down Expand Up @@ -1050,7 +1050,7 @@ do
<br>
Suggestion:
<code>
Perhaps you should remove it.
You can remove it.
</code>
<br>
</td>
Expand Down Expand Up @@ -1319,7 +1319,7 @@ where
<br>
Suggestion:
<code>
Perhaps you should remove it.
You can 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 can 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 can 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 can 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 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
Expand Down
Loading