-
Notifications
You must be signed in to change notification settings - Fork 20
/
.scalafix.conf
155 lines (149 loc) · 4.5 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
rules = [
Disable
DisableSyntax
LeakingImplicitClassVal
MissingFinal
NoAutoTupling
NoValInForComprehension
]
Disable.symbols = [
{
regex = "^\\Qscala/math/Big\\E.*$"
message = "Scala's arbitrary precision numbers lack the precision of their Java counterparts (https://github.com/scala/bug/issues/9670), use the ones in Java standard library."
}
{
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 typeclasses: cats.{kernel.Eq, kernel.Hash, Show} or alternatives."
}
{
symbol = "scala/Enumeration"
message = "Prefer sealed trait/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 = "This is not a total function (a total function is a function that is defined for all possible values of its input - it terminates and returns a value)."
}
]
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 side-effectful. It must be wrapped in 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 = "This is not a total function (a total function is a function that is defined for all possible values of its input - it terminates and returns a value). Wrap in Either.catchNonFatal or similar."
}
]
}
]
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
}