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

Warn on use of unsafe decodeUtf8 #1280

Open
wants to merge 1 commit 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
18 changes: 18 additions & 0 deletions data/hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
- import Data.Attoparsec.Text
- import Data.Attoparsec.ByteString

- package:
name: text
modules:
- import Data.Text
- import Data.Text.Encoding

- package:
name: codeworld-api
modules:
Expand Down Expand Up @@ -869,6 +875,14 @@
- warn: {lhs: Data.Attoparsec.Text.option Nothing (Just <$> p), rhs: optional p}
- warn: {lhs: Data.Attoparsec.ByteString.option Nothing (Just <$> p), rhs: optional p}

- group:
name: text
enabled: true
imports:
- package text
rules:
- warn: {lhs: decodeUtf8, rhs: decodeUtf8', name: Avoid decodeUtf8}

- group:
name: generalise
enabled: false
Expand Down Expand Up @@ -1235,6 +1249,10 @@
# issue1183 = (a >= 'a') && (a <= 'z') -- isAsciiLower a
# issue1218 = uncurry (zipWith g) $ (a, b) -- zipWith g a b

# import Data.Text
# import Data.Text.Encoding
# yes = decodeUtf8 -- decodeUtf8'

# import Language.Haskell.TH\
# yes = varE 'foo -- [|foo|]
# import Prelude \
Expand Down
16 changes: 16 additions & 0 deletions hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -11921,4 +11921,20 @@ optional p
</td>
<td>Warning</td>
</tr>
<tr>
<td>Avoid decodeUtf8</td>
<td>
LHS:
<code>
Data.Text.Encoding.decodeUtf8
</code>
<br>
RHS:
<code>
Data.Text.Encoding.decodeUtf8'
</code>
<br>
</td>
<td>Warning</td>
</tr>
</table>