forked from haskell/haskell-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.hlint.yaml
262 lines (234 loc) · 7.48 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# To run HLint do:
# $ hlint --git -j4
# Ignore all lints in testdata directories, as they are distracting.
- ignore: { "within": '**/testdata/**' }
- ignore: { "within": '**/test/data/**' }
# Warnings currently triggered by our code
- ignore: {name: "Use <$>"}
- ignore: {name: "Use :"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Avoid lambda"}
- ignore: {name: "Use newtype instead of data"}
- ignore: {name: "Use unless"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Eta reduce"}
- ignore: {name: "Parse error"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use ++"}
- ignore: {name: "Use $>"}
- ignore: {name: "Use section"}
- ignore: {name: "Use record patterns"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Avoid lambda using `infix`"}
- ignore: {name: "Replace case with fromMaybe"}
# Gives at least one suggestion we don't like.
- ignore: {name: "Use <=<"}
- ignore: {name: "Use zipFrom"}
- ignore: {name: "Use zipWithFrom"}
# We are using the "redundant" return/pure to assign a name. We do not want to
# delete it. In particular, this is not an improvement:
# Found:
# do options <- somethingComplicated
# pure options
# Perhaps:
# do somethingComplicated
- ignore: {name: "Redundant return"}
- ignore: {name: "Redundant pure"}
# Off by default hints we like
- warn: {name: Use module export list}
# Condemn nub and friends
- warn: {lhs: nub (sort x), rhs: Data.List.Extra.nubSort x}
- warn: {lhs: nub, rhs: Data.List.Extra.nubOrd}
- warn: {lhs: nubBy, rhs: Data.List.Extra.nubOrdBy}
- warn: {lhs: Data.List.Extra.nubOn, rhs: Data.List.Extra.nubOrdOn}
- functions:
# Things that are unsafe in Haskell base library
- name: unsafePerformIO
within:
- Development.IDE.Core.Shake
- Development.IDE.GHC.Util
- Development.IDE.Core.FileStore
- Development.IDE.Plugin.CodeAction.Util
- Development.IDE.Graph.Internal.Database
- Development.IDE.Graph.Internal.Paths
- Development.IDE.Graph.Internal.Profile
- Development.IDE.Graph.Internal.Types
- Ide.Types
- Test.Hls
- Test.Hls.Command
- Wingman.Debug
- Wingman.Types
- AutoTupleSpec
- name: unsafeInterleaveIO
within:
- Development.IDE.LSP.LanguageServer
- {name: unsafeDupablePerformIO, within: []}
- name: unsafeCoerce
within:
- Ide.Plugin.Eval.Code
- Development.IDE.Core.Compile
- Development.IDE.Types.Shake
- Wingman.Judgements.SYB
- Ide.Plugin.Properties
# Things that are a bit dangerous in the GHC API
- name: nameModule
within:
- Development.IDE.GHC.CoreFile
- Ide.Plugin.CallHierarchy.Internal
- Ide.Plugin.Rename
- Compat.HieBin
# Partial functions
# We need to check fucntions which
# are typically exported multiple ways under both names,
# see https://github.com/ndmitchell/hlint/issues/1389
- name: [Prelude.head, Data.List.head]
within:
- Main
- Experiments
- Development.Benchmark.Rules
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Spans.Documentation
- Development.IDE.Session
- Ide.Plugin.CallHierarchy.Internal
- Ide.Plugin.Eval.Code
- Ide.Plugin.Eval.Util
- Ide.Plugin.Floskell
- Ide.Plugin.ModuleName
- Ide.Plugin.Rename
- Ide.Plugin.Class.ExactPrint
- TExpectedActual
- TRigidType
- TRigidType2
- RightToLeftFixities
- Typeclass
- Wingman.Judgements
- Wingman.Machinery
- Wingman.Tactics
- CompletionTests #Previously part of GHCIDE Main tests
- DiagnosticTests #Previously part of GHCIDE Main tests
- FindDefinitionAndHoverTests #Previously part of GHCIDE Main tests
- TestUtils #Previously part of GHCIDE Main tests
- CodeLensTests #Previously part of GHCIDE Main tests
- name: [Prelude.tail, Data.List.tail]
within:
- Main
- Development.Benchmark.Rules
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Session
- UnificationSpec
- WatchedFileTests #Previously part of GHCIDE Main tests
- name: [Prelude.last, Data.List.last]
within:
- Main
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Spans.Common
- Development.IDE.Graph.Internal.Types
- Ide.PluginUtils
- Ide.Plugin.Eval.Parse.Comments
- Ide.Plugin.Eval.CodeLens
- FindDefinitionAndHoverTests #Previously part of GHCIDE Main tests
- name: [Prelude.init, Data.List.init]
within:
- Main
- Development.IDE.Spans.Common
- Ide.PluginUtils
- Wingman.Metaprogramming.Parser
- Development.Benchmark.Rules
- ErrorGivenPartialSignature
- IfaceTests #Previously part of GHCIDE Main tests
- THTests #Previously part of GHCIDE Main tests
- WatchedFileTests #Previously part of GHCIDE Main tests
- name: Data.List.foldl1'
within: []
- name: Data.List.foldr1'
within: []
- name: ["Prelude.!!", "Data.List.!!"]
within:
- Main
- Experiments
- FunctionalCodeAction
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions.Logic
- Development.IDE.Spans.Documentation
- TErrorGivenPartialSignature
- Wingman.CaseSplit
- Wingman.Simplify
- InitializeResponseTests #Previously part of GHCIDE Main tests
- PositionMappingTests #Previously part of GHCIDE Main tests
- name: Data.Text.head
within:
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions.Logic
- name: Data.Foldable.foldl1
within: []
- name: Data.Foldable.foldr1
within:
- Wingman.Tactics
- name: Data.Maybe.fromJust
within:
- Experiments
- Main
- MultipleImports
- Progress
- Utils
- Development.IDE.Core.Compile
- Development.IDE.Core.Rules
- Development.IDE.Core.Shake
- Development.IDE.Plugin.Completions
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Plugin.CodeAction
- Development.IDE.Test
- Development.IDE.Graph.Internal.Profile
- Development.IDE.Graph.Internal.Rules
- Ide.Plugin.Class
- CodeLensTests #Previously part of GHCIDE Main tests
- name: "Data.Map.!"
within:
- Wingman.LanguageServer
- name: "Data.IntMap.!"
within: []
- name: "Data.Vector.!"
within: []
- name: "GHC.Arr.!"
within: []
# We do not want to use functions from the
# GHC driver. Instead use hls rules to construct
# an appropriate GHC session
- name: "load"
within: []
- name: "load'"
within: []
- name: "loadWithCache"
within: []
# Tracing functions
# We ban an explicit list rather than the
# Debug.Trace, because that module also
# includes the eventlog tracing functions,
# which are legitimate to use.
- name:
- Debug.Trace.trace
- Debug.Trace.traceId
- Debug.Trace.traceShow
- Debug.Trace.traceShowId
- Debug.Trace.traceStack
- Debug.Trace.traceIO
- Debug.Trace.traceM
- Debug.Trace.traceShowM
- Debug.Trace.putTraceMsg
within:
- Development.IDE.Core.Compile
- Development.IDE.Graph.Internal.Database
- Development.IDE.GHC.Util
- Development.IDE.Plugin.CodeAction.Util
- Wingman.Debug
# We really do not want novel usages of restricted functions, and mere
# Warning is not enough to prevent those consistently; you need a build failure.
- error: {name: Avoid restricted function}