forked from NorfairKing/haskell-dangerous-functions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hlint.yaml
133 lines (104 loc) · 5.23 KB
/
hlint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Haskell's Dangerous Functions
# For a how-to-use and the latest version of this file go to:
# https://github.com/NorfairKing/haskell-dangerous-functions/
- ignore: { name: "Use unless" }
- ignore: { name: "Use tuple-section" }
- functions:
- {name: unsafeDupablePerformIO, within: []} # Unsafe
- {name: unsafeInterleaveIO, within: []} # Unsafe
- {name: unsafeFixIO, within: []} # Unsafe
- {name: unsafePerformIO, within: []} # Unsafe
# _VERY_ hard to get right, use the async library instead.
# See also https://github.com/informatikr/hedis/issues/165
- {name: forkIO, within: []}
# Mostly impossible to get right, rethink what you're doing entirely.
# See also https://www.reddit.com/r/haskell/comments/jsap9r/how_dangerous_is_forkprocess/
- {name: forkProcess, within: []}
- {name: undefined, within: []} # Purposely fails. Deal with errors appropriately instead.
- {name: throw, within: []} # Don't throw from pure code, use throwIO instead.
- {name: Prelude.error, within: []}
- {name: Data.List.head, within: []} # Partial, use `listToMaybe` instead.
- {name: Data.List.tail, within: []} # Partial
- {name: Data.List.init, within: []} # Partial
- {name: Data.List.last, within: []} # Partial
- {name: 'Data.List.!!', within: []} # Partial
- {name: Data.List.genericIndex, within: []} # Partial
- {name: Data.List.genericLength, within: []} # Use `fromIntegeral . length` instead
# Same, but for Data.Text
- {name: Data.Text.head, within: []}
- {name: Data.Text.tail, within: []}
- {name: Data.Text.init, within: []}
- {name: Data.Text.last, within: []}
- {name: minimum, within: []} # Partial
- {name: minimumBy, within: []} # Partial
- {name: maximum, within: []} # Partial
- {name: maximumBy, within: []} # Partial
# Same, but for Data.Text
- {name: Data.Text.maximum, within: []}
- {name: Data.Text.minimum, within: []}
- {name: GHC.Enum.pred, within: []} # Partial
- {name: GHC.Enum.succ, within: []} # Partial
- {name: GHC.Enum.toEnum, within: []} # Partial
- {name: GHC.Enum.fromEnum, within: []} # Does not do what you think it does.
- {name: GHC.Enum.enumFrom, within: []} # Does not do what you think it does, depending on the type.
- {name: GHC.Enum.enumFromThen, within: []} # Does not do what you think it does, depending on the type.
- {name: GHC.Enum.enumFromTo, within: []} # Does not do what you think it does, depending on the type.
- {name: GHC.Enum.enumFromThenTo, within: []} # Does not do what you think it does, depending on the type.
- {name: unless, within: []} # Really confusing, use 'when' instead.
- {name: either, within: []} # Really confusing, just use a case-match.
- {name: nub, within: []} # O(n^2)
- {name: Data.Foldable.foldl, within: []} # Lazy accumulator. Use foldl' instead.
- {name: Data.Foldable.foldMap, within: []} # Lazy accumulator. Use foldMap' instead.
- {name: Data.Foldable.sum, within: []} # Lazy accumulator
- {name: Data.Foldable.product, within: []} # Lazy accumulator
# Functions involving division
- {name: Prelude.quot, within: []} # Partial, see https://github.com/NorfairKing/haskell-WAT#num-int
- {name: Prelude.div, within: []}
- {name: Prelude.rem, within: []}
- {name: Prelude.mod, within: []}
- {name: Prelude.quotRem, within: []}
- {name: Prelude.divMod, within: []}
# Does unexpected things, see
# https://github.com/NorfairKing/haskell-WAT#real-double
- {name: realToFrac, within: []}
# Constructs rationals, which is either wrong or a bad idea.
- {name: 'Data.Ratio.%', within: []}
# Don't use string for command-line output.
- {name: System.IO.putChar, within: []}
- {name: System.IO.putStr, within: []}
- {name: System.IO.putStrLn, within: []}
- {name: System.IO.print, within: []}
# Don't use string for command-line input either.
- {name: System.IO.getChar, within: []}
- {name: System.IO.getLine, within: []}
- {name: System.IO.getContents, within: []} # Does lazy IO.
- {name: System.IO.interact, within: []}
- {name: System.IO.readIO, within: []}
- {name: System.IO.readLn, within: []}
# Don't use strings to interact with files
- {name: System.IO.readFile, within: []}
- {name: System.IO.writeFile, within: []}
- {name: System.IO.appendFile, within: []}
# Can succeed in dev, but fail in prod, because of encoding guessing
# It's also Lazy IO.
# See https://www.snoyman.com/blog/2016/12/beware-of-readfile/ for more info.
- {name: Data.Text.IO.readFile, within: []}
- {name: Data.Text.IO.Lazy.readFile, within: []}
- {name: Data.Text.Encoding.decodeUtf8, within: []} # Throws on invalid UTF8
- {name: fromJust, within: [], message: 'Partial'} # Partial
# Does silent truncation:
# > fromIntegral (300 :: Word) :: Word8
# 44
- {name: fromIntegral, within: []}
- {name: 'read', within: []} # Partial, use `Text.Read.readMaybe` instead.
# Deprecated, use `pure` instead.
# See https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return
- {name: 'return', within: []}
- modules:
- { name: Control.Lens, within: [] }
- extensions:
- { name: DeriveAnyClass, within: [] } # Dangerous
- { name: DuplicateRecordFields, within: [] }
- { name: NamedFieldPuns, within: [] }
- { name: TupleSections, within: [] }
- { name: OverloadedLabels, within: [] }