-
Notifications
You must be signed in to change notification settings - Fork 0
/
.scalafix.conf
169 lines (162 loc) · 4.42 KB
/
.scalafix.conf
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
rules = [
Disable
DisableSyntax
LeakingImplicitClassVal
MissingFinal
NoAutoTupling
NoValInForComprehension
ProcedureSyntax
RemoveUnused
SortImports
]
Disable.symbols = [
{
regex = "^\\Qscala/math/Big\\E.*$"
message = "scala arbitrary precision numbers are broken: https://github.com/scala/bug/issues/9670"
}
{
regex = "^\\Qjava/net/URL#\\E.*$"
message = "URL talks to the network for equality, prefer URI"
}
{
regex = {
includes = [
# overrides not fully implemented: https://github.com/scalacenter/scalafix/pull/634
"^.*\\Q#equals().\\E$"
"^.*\\Q#hashCode().\\E$"
"^.*\\Q#toString().\\E$" # doesn't catch string interpolators...
# more to add here...
]
}
message = "prefer cats.{kernel.Eq, kernel.Hash, Show, etc}"
}
{
symbol = "scala/Enumeration"
message = "prefer a sealed abstract class"
}
{
regex = {
includes = [
"^\\Qscala/util/Either.LeftProjection#get().\\E$"
"^\\Qscala/util/Either.RightProjection#get().\\E$"
"^\\Qscala/util/Try#get().\\E$"
"^\\Qscala/Option#get().\\E$"
"^\\Qscala/collection/IterableLike#head().\\E$"
]
}
message = "not a total function"
}
]
Disable.ifSynthetic = [
"java/io/Serializable"
"scala/Any"
"scala/Product"
# when upstream broke noImplicitConversion and we don't agree that their
# implicits are worth the mental burden.
"scala/Option.option2Iterable"
"scala/Predef.any2stringadd"
# I don't understand why these are synthetic
# https://github.com/scalacenter/scalafix/issues/703
{
regex = {
includes = [
"^\\Qscala/collection/MapLike#apply().\\E$"
"^\\Qscala/collection/LinearSeqOptimized#apply().\\E$"
]
}
message = "not a total function"
}
]
Disable.unlessInside = [
{
safeBlocks = [
"cats/effect/IO"
"cats/effect/Sync.delay"
"monix/eval/Task"
"cats/ApplicativeError.handleError"
"cats/ApplicativeError.raiseError"
"cats/syntax/ApplicativeErrorOps.handleError"
"cats/syntax/ApplicativeErrorOps.recover"
"zio/IO"
"zio/Task"
"zio/ZIO"
"zio/ZIO_E_Throwable.effect"
"zio/ZIOFunctions.effectAsync"
"zio/ZIOFunctions.effectTotal"
"zio/ZIOFunctions.effectTotalWith"
"zio/ZIOFunctions.fail"
"zio/ZIOFunctions.halt"
]
symbols = [
{
# If something is referentially transparent but not total, instead of
# adding to this excludes list, add it to the includes list of the
# cats.syntax.EitherObjectOps.catchNonFatal safeBlock.
regex = {
includes = [
"^\\Qjava/net/InetAddress#getByAddress().\\E$"
"^\\Qjava/net/InetAddress#getByName(\\E.*$"
"^\\Qjava/net/InetSocketAddress#<init>().\\E$"
"^\\Qjava/net/InetSocketAddress#<init>(+2).\\E$"
]
excludes = [
]
}
message = "Method is sideeffectful, must be called from Task/IO/ZIO"
}
]
}
{
safeBlocks = [
"cats/syntax/EitherObjectOps.catchNonFatal"
"cats/data/Validated.catchNonFatal"
"cats/ApplicativeError.catchNonFatal"
"cats/effect/IO"
"cats/effect/Sync.delay"
"monix/eval/Task"
"zio/IO"
"zio/Task"
"zio/ZIO"
"zio/ZIO_E_Throwable.effect"
]
symbols = [
{
regex = {
includes = [
"^\\Qjava/net/URLEncoder#\\E.*$"
"^\\Qjava/net/URLDecoder#\\E.*$"
"^\\Qjava/net/InetAddress#getByAddress(+1).\\E$"
"^\\Qjava/net/InetSocketAddress#<init>(+1).\\E$"
"^\\Qjava/net/InetSocketAddress#createUnresolved().\\E$"
]
excludes = [
]
}
message = "Deterministic method is not total, must be called via Either.catchNonFatal, etc."
}
]
}
]
DisableSyntax {
noAsInstanceOf = true
noFinalize = true
noImplicitConversion = true
noImplicitObject = true // https://stackoverflow.com/questions/20380800/scala-implicits-resolution-mechanism-is-declaration-order-dependent#comment31809401_20381535
noIsInstanceOf = true
noNulls = true
noReturns = true
noSemicolons = true
noTabs = true
noThrows = true
noUniversalEquality = true
noValPatterns = true
noVars = true
noWhileLoops = true
noXml = true
}
# IntelliJ IDEA's order in order not to fight each other
SortImports.blocks = [
"java."
"*"
"scala."
]