-
Notifications
You must be signed in to change notification settings - Fork 3
/
.hlint.yaml
123 lines (110 loc) · 4.31 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
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io>
#
# SPDX-License-Identifier: Unlicense
###########################################################################
# Settings
###########################################################################
- arguments: [-XTypeApplications, -XRecursiveDo, -XBlockArguments, -XQuasiQuotes]
# These are just too annoying
- ignore: { name: Redundant do }
- ignore: { name: Redundant bracket }
- ignore: { name: Redundant lambda }
- ignore: { name: Redundant flip }
- ignore: { name: Move brackets to avoid $ }
- ignore: { name: Avoid lambda using `infix` }
# Losing variable names can be not-nice
- ignore: { name: Eta reduce }
- ignore: { name: Avoid lambda }
# Humans know better
- ignore: { name: Use camelCase }
- ignore: { name: Use const }
- ignore: { name: Use section }
- ignore: { name: Use if }
- ignore: { name: Use notElem }
- ignore: { name: Use fromMaybe }
- ignore: { name: Replace case with fromMaybe }
- ignore: { name: Use maybe }
- ignore: { name: Use fmap }
- ignore: { name: Use foldl }
- ignore: { name: "Use :" }
- ignore: { name: Use ++ }
- ignore: { name: Use || }
- ignore: { name: Use && }
- ignore: { name: 'Use ?~' }
- ignore: { name: Use <$> }
- ignore: { name: Use unless }
# Sometimes [Char] is okay (if it means "a sequence of characters")
- ignore: { name: Use String }
# Sometimes TemplateHaskell is needed to please stylish-haskell
- ignore: { name: Unused LANGUAGE pragma }
# Some 'data' records will be extended with more fields later,
# so they shouldn't be replaced with 'newtype' blindly
- ignore: { name: Use newtype instead of data }
###########################################################################
# Various stuff
###########################################################################
- warn:
name: "Avoid 'both'"
lhs: both
rhs: Control.Lens.each
note: |
If you use 'both' on a 2-tuple and later it's accidentally
replaced with a longer tuple, 'both' will be silently applied to only
the *last two elements* instead of failing with a type error.
* If you want to traverse all elements of the tuple, use 'each'.
* If 'both' is used on 'Either' here, replace it with 'chosen'.
- warn: { lhs: either (const True) (const False), rhs: isLeft }
- warn: { lhs: either (const False) (const True), rhs: isRight }
- warn: { lhs: map fst &&& map snd, rhs: unzip }
- warn:
name: "'fromIntegral' is unsafe without type annotations."
lhs: fromIntegral x
rhs: fromIntegral @t1 @t2 x
- warn:
name: "'fromIntegral' is unsafe without TWO type annotations."
lhs: fromIntegral @t1 x
rhs: fromIntegral @t1 @t2 x
- warn:
name: "Avoid the use of '(+||)' and '(||+)'"
lhs: '(Fmt.+||)'
rhs: '(Fmt.+|)'
note: "The use of '(+||)' may result in outputting raw Haskell into user-facing code"
- warn:
name: "Avoid the use of '(+||)' and '(||+)'"
lhs: '(Fmt.||+)'
rhs: '(Fmt.|+)'
note: "The use of '(||+)' may result in outputting raw Haskell into user-facing code"
- warn:
name: "Avoid the use of '(||++||)'"
lhs: '(Fmt.||++||)'
rhs: '(Fmt.|++|)'
note: "The use of '(||++||)' may result in outputting raw Haskell into user-facing code"
- warn:
name: "Avoid the use of '(||++|)'"
lhs: '(Fmt.||++|)'
rhs: '(Fmt.|++|)'
note: "The use of '(||++|)' may result in outputting raw Haskell into user-facing code"
- warn:
name: "Avoid colorize function that ignore ColorMode"
lhs: 'System.Console.Pretty.colorize'
rhs: 'Xrefcheck.Util.Colorize.colorizeIfNeeded'
- warn:
name: "Avoid color function that ignore ColorMode"
lhs: 'System.Console.Pretty.color'
rhs: 'Xrefcheck.Util.Colorize.colorIfNeeded'
- warn:
name: "Avoid style function that ignore ColorMode"
lhs: 'System.Console.Pretty.style'
rhs: 'Xrefcheck.Util.Colorize.styleIfNeeded'
- warn:
name: "Avoid functions that generate extra trailing newlines/whitespaces"
lhs: 'Fmt.indentF'
rhs: 'Xrefcheck.Util.Interpolate.interpolateIndentF'
- warn:
name: "Avoid functions that generate extra trailing newlines/whitespaces"
lhs: 'Fmt.blockListF'
rhs: 'Xrefcheck.Util.Interpolate.interpolateBlockListF'
- warn:
name: "Avoid functions that generate extra trailing newlines/whitespaces"
lhs: "Fmt.blockListF'"
rhs: "Xrefcheck.Util.Interpolate.interpolateBlockListF'"