-
Notifications
You must be signed in to change notification settings - Fork 173
/
.hlint.yaml
87 lines (79 loc) · 5.9 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
- arguments: [-XTypeApplications, -XNumericUnderscores]
# Often, code is more readable with extra parens, or less readable with list comprehensions
- ignore: {name: "Redundant bracket"}
- ignore: {name: "Use list comprehension"}
# Hlint 3.6.1 has a bug where typed TH splices are not recognized so it reports
# TemplateHaskell as an unused pragma: https://github.com/ndmitchell/hlint/issues/1531
# A fix is merged, but has not yet been released.
# Remove the ignore directive when this commit makes it into a release and is part of haskell-dev-tools.
# https://github.com/ndmitchell/hlint/commit/505a4d57b972f3ba605ad7a59721cef1f3d98a84
- ignore: {name: "Unused LANGUAGE pragma", within: [App.Version.TH, App.Version]}
# Import Preferences
- modules:
- {name: Data.Set, as: Set, message: "Use complete name for qualified import of Set"}
- {name: Data.Map, as: Map, message: "Use complete name for qualified import of Map"}
- {name: Data.Map.Strict, as: Map, message: "Use complete name for qualified import of Strict Map"}
- {name: Data.Text, as: Text, message: "Use complete name for qualified import of Text"}
# Don't allow unsafe IO
- {name: System.IO.Unsafe, within: []}
# Arrows are more complicated than the problem they solve
- {name: Control.Arrow, within: []}
# Styling Preferences
- suggest: {lhs: "asum [x, y]", rhs: x <|> y}
- suggest: {lhs: return, rhs: pure}
- suggest: {lhs: () <$ x, rhs: Control.Monad.void x}
- suggest: {lhs: x <&> f, rhs: f <$> x}
- suggest: {lhs: mapM, rhs: traverse}
- suggest: {lhs: forM, rhs: for}
- suggest: {lhs: forM_, rhs: for_}
- suggest: {lhs: Data.Text.pack, rhs: Data.String.Conversion.toText}
- ignore: {name: "Use toText", within: ["Data.String.Conversion"]}
- suggest: {lhs: Data.Text.unpack, rhs: Data.String.Conversion.toString}
- ignore: {name: "Use toString", within: ["Data.String.Conversion"]}
- suggest: {lhs: Data.List.foldl, rhs: Data.List.foldl'}
- suggest: {lhs: Prelude.foldl, rhs: Data.List.foldl'}
- suggest: {lhs: "(Data.Set.size x) == 0" , rhs: "Data.Set.null x"}
- suggest: {lhs: "(Data.Set.size x) /= 0" , rhs: "not $ Data.Set.null x"}
- group:
name: stm
enabled: true
rules:
- hint: {lhs: Control.Concurrent.STM.takeTMVar, rhs: Control.Concurrent.STM.tryTakeTMVar, note: "Blocks if the TMVar is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.putTMVar, rhs: Control.Concurrent.STM.writeTMVar, note: "Blocks if the TMVar is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.readTMVar, rhs: Control.Concurrent.STM.tryReadTMVar, note: "Blocks if the TMVar is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TQueue.readTQueue, rhs: Control.Concurrent.STM.TQueue.tryReadTQueue, note: "Retries and blocks if the TBQueue is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TQueue.peekTQueue, rhs: Control.Concurrent.STM.TQueue.tryPeekTQueue, note: "Retries and blocks if the TBQueue is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TBQueue.readTBQueue, rhs: Control.Concurrent.STM.TBQueue.tryReadTBQueue, note: "Retries and blocks if the TBQueue is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TBQueue.peekTBQueue, rhs: Control.Concurrent.STM.TBQueue.tryPeekTBQueue, note: "Retries and blocks if the TBQueue is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TBQueue.unGetTBQueue, rhs: Control.Concurrent.STM.TBQueue.unGetTBQueue, note: "Retries and blocks if the TBQueue is full. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TBMQueue.readTBMQueue, rhs: Control.Concurrent.STM.TBMQueue.tryReadTBMQueue, note: "Retries and blocks if the TBMQueue is empty and open. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TBMQueue.peekTBMQueue, rhs: Control.Concurrent.STM.TBMQueue.tryPeekTBMQueue, note: "Retries and blocks if the TBMQueue is empty. Be sure this is correct behavior."}
- hint: {lhs: Control.Concurrent.STM.TBMQueue.writeTBMQueue, rhs: Control.Concurrent.STM.TBMQueue.tryWriteTBMQueue, note: "Retries and blocks if the TBMQueue is full. Be sure this is correct behavior."}
# Forbidden items, only allowed in compile-time code, or test code (however, it should be avoided in tests as much as possible).
- functions:
- {name: error, within: [Data.String.Conversion, Control.Effect.Replay]}
- {name: undefined, within: []}
- {name: Prelude.head, within: [Control.Effect.*.TH, "**.*Spec"], message: "Use Data.List.Extra.head' instead."}
- {name: Prelude.tail, within: [Data.FileEmbed.Extra]}
- {name: Prelude.init, within: []}
- {name: Prelude.last, within: ["**.*Spec"]}
- {name: Data.ByteString.head, within: []}
- {name: Data.Bytestring.tail, within: []}
- {name: Data.Bytestring.init, within: []}
- {name: Data.Bytestring.last, within: []}
- {name: Data.Text.head, within: []}
- {name: Data.Text.tail, within: []}
- {name: Data.Text.init, within: []}
- {name: Data.Text.last, within: []}
# TODO: remove special-case
- {name: Data.List.NonEmpty.fromList, within: ["App.Fossa.Analyze.Filter", "Test.Fixtures", "**.*Spec"], message: "Pattern-match on nonEmpty instead of forcing the list."}
- {name: "Prelude.!!", within: ["**.*Spec"]}
- {name: "Data.Map.!", within: []}
# TODO: remove the need to special-case this test module.
- {name: fromJust, within: [App.DocsSpec]}
- {name: Test.Hspec.fdescribe, within: [], message: "May prevent tests from running"}
# We define fit' in terms of fit,so this is necessary
- {name: Test.Hspec.fit, within: [Test.Effect], message: "May prevent tests from running"}
- {name: Test.Hspec.focus, within: [], message: "May prevent tests from running"}
- {name: Test.Hspec.fspecify, within: [], message: "May prevent tests from running"}
- {name: Test.Hspec.fcontext, within: [], message: "May prevent tests from running"}