-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
.hlint.yaml
181 lines (160 loc) · 5.21 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
- ignore:
name: "Use tuple-section"
- ignore:
name: "Use newtype instead of data"
- ignore:
name: "Use uncurry"
- ignore:
name: "Use record patterns"
- ignore:
name: "Use String"
- ignore:
name: "Use second"
- ignore:
name: "Use rights"
- ignore:
name: "Use Just"
- ignore:
name: "Use void"
- ignore:
name: "Use const"
- ignore:
name: "Use map once"
- ignore:
name: "Use lambda-case"
- ignore:
name: "Fuse concatMap/map"
- ignore:
name: "Fuse mapMaybe/map"
- ignore:
name: "Reduce duplication"
- ignore:
name: "Redundant do"
- ignore:
name: "Redundant case"
- ignore:
name: "Redundant <$>"
- ignore:
name: "Use <=<"
- ignore:
name: "Use ++"
- ignore:
name: "Use &&"
- ignore:
name: "Use ||"
within:
- "Smos.Draw.drawEntry"
- "Smos.Draw.drawEntryCursor"
- ignore:
name: "Use camelCase"
within:
- "Smos.Report.Archive.HideArchive"
- "Smos.Scheduler.Commands.Schedule"
- ignore:
name: "Use <$>"
within:
- "Smos.Actions.Entry.TodoState.allTodoStatePlainActions"
- "Smos.Report.Filter.astUnOpP"
- ignore:
name: "Avoid lambda"
- ignore:
name: "Avoid lambda using `infix`"
- ignore:
name: "Eta reduce"
- ignore:
name: "Redundant if"
within:
- "Smos.Draw.completedForestNumbersWidget"
- "Smos.Sync.Client.Contents"
- "Smos.Sync.Client.isHidden"
- "Smos.Calendar.Import.RecurrenceRule.Type"
- "Smos.Calendar.Import.RecurrenceRule.Recurrence.Util"
- "Smos.Client"
- ignore:
name: "Replace case with maybe"
- ignore:
name: "Use record patterns"
within:
- "Smos.Docs.Site.Handler.Keybindings"
- "Smos.OptParse.Types"
- ignore:
name: "Hoist not"
within:
- "Smos.Calendar.Import.RecurrenceRule"
- "Smos.Calendar.Import.RecurrenceRule.Gen"
- ignore:
name: "Use bimap"
# Functions that we dissallow.
# Note that you _can_ add exceptions to these hints, but those exceptions should be thorougly reviewed.
- functions:
- {name: unsafeDupablePerformIO, within: []} # Unsafe
- {name: unsafeInterleaveIO, within: []} # Unsafe
- {name: unsafeFixIO, within: []} # Unsafe
- name: unsafePerformIO # Unsafe
within:
- Smos.API.SHA256
- {name: forkIO, within: []} # Hard to get right, use the async library instead.
- {name: throw, within: []} # Don't throw from pure code, use throwIO instead.
- {name: Data.List.head, within: []} # Partial
- {name: Data.List.tail, within: []} # Partial
- {name: Data.List.init, within: []} # Partial
- {name: Data.List.last, within: []} # Partial
- {name: '!!', within: []} # Partial
- {name: until, within: []} # Really confusing, use 'when' instead.
- name: toEnum # Partial
within:
- Smos.Report.TimeBlock
- {name: Data.Foldable.foldl, within: []} # Lazy. Use foldl' instead.
# This is no longer an issue as of GHC 9.0.1
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4675
# but we still use an older version of GHC.
# As soon as we upgrade the LTS, we can replace the usages of `foldl' (+) 0` in the code
- {name: sum, within: []} # Lazy accumulator
- {name: product, within: []} # Lazy accumulator
# Don't use strings to interact with files
- {name: System.IO.readFile, within: []}
- {name: System.IO.writeFile, within: []}
- {name: System.IO.appendFile, within: []}
# Don't use string for command-line output.
- {name: System.IO.putStr, within: []}
- {name: System.IO.print, within: []}
- name: System.IO.putChar
within:
- Smos.Sync.Client.Prompt
# 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: []}
# 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: System.IO.readFile, within: []}
- {name: Data.Text.IO.readFile, within: []}
- {name: Data.Text.IO.Lazy.readFile, within: []}
- {name: Prelude.read, within: []} # Partial, use `Text.Read.readMaybe` instead.
- {name: nub, within: []} # O(n^2)
# Still to add
# - {name: decodeUtf8, within: []} # Partial, use decodeUtf8' instead.
# - {name: Prelude.putStrLn, within: []}
# # We don't disallow 'undefined' because of the undefined trick.
# # It wolud be nice if there was a way to automatically check that all usages of undefined were because of the undefined trick...
# # - {name: 'error', within: []} # Purposely fails
# # Does unexpected things, see
# # https://github.com/NorfairKing/haskell-WAT#real-double
# - {name: realToFrac, within: []}
# # Does silent truncation:
# # > fromIntegral (300 :: Word) :: Word8
# # 44
# - {name: fromIntegral, within: []}
# Until this we use a version of hlint that has this issue fixed:
# https://github.com/ndmitchell/hlint/issues/1557
- ignore:
name: "Unused LANGUAGE pragma"
within:
- Smos.Docs.Site.Changelog
- Smos.Docs.Site.ModuleDocs
- Smos.Docs.Site.DependencyGraph
- Smos.Docs.Site.Static