-
Notifications
You must be signed in to change notification settings - Fork 17
/
scalastyle-config.xml
230 lines (230 loc) · 13.1 KB
/
scalastyle-config.xml
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<scalastyle>
<name>Parsley configuration</name>
<check enabled="true" class="org.scalastyle.file.FileLengthChecker" level="warning">
<parameters>
<parameter name="maxFileLength">1500</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.file.FileLineLengthChecker" level="warning">
<parameters>
<parameter name="maxLineLength">160</parameter>
<parameter name="tabSize">4</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.file.FileTabChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.file.NewLineAtEofChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.file.NoNewLineAtEofChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.file.RegexChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.file.WhitespaceEndOfLineChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.scalariform.BlockImportChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.CaseBraceChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.ClassNamesChecker" level="warning">
<parameters>
<parameter name="regex">^[^a-z].*$</parameter>
</parameters>
<customMessage>Classes must not start with a lowercase letter!</customMessage>
</check>
<check enabled="true" class="org.scalastyle.scalariform.ClassTypeParameterChecker" level="warning">
<parameters>
<parameter name="regex">^[A-Z_]|Err$</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.CovariantEqualsChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.scalariform.CurliesImportChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.CyclomaticComplexityChecker" level="warning">
<parameters>
<parameter name="maximum">10</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.DeprecatedJavaChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.DisallowSpaceAfterTokenChecker" level="warning">
<parameters>
<parameter name="tokens">LPAREN</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.DisallowSpaceBeforeTokenChecker" level="warning">
<parameters>
<parameter name="tokens">COMMA, RPAREN</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.EmptyClassChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.EmptyInterpolatedStringChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.EnsureSingleSpaceAfterTokenChecker" level="warning">
<parameters>
<parameter name="tokens">COLON, IF, FOR, WHILE, TRY, MATCH, LINE_COMMENT</parameter>
</parameters>
</check>
<!-- Unneeded, unless it supports multiple chars before! -->
<check enabled="false" class="org.scalastyle.scalariform.EnsureSingleSpaceBeforeTokenChecker" level="warning">
<parameters>
<parameter name="tokens">ARROW</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.EqualsHashCodeChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.FieldNamesChecker" level="warning">
<parameters>
<parameter name="regex">^_?[a-z][A-Za-z0-9]*_?$</parameter>
<!-- In principle, we want this, but the parsers in character and Parsley are lowercase leading... -->
<!--<parameter name="objectFieldRegex">^[A-Z][A-Za-z0-9]*$</parameter>-->
<parameter name="objectFieldRegex">^_?[a-zA-Z][A-Za-z0-9]*$</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.ForBraceChecker" level="warning">
<parameters>
<parameter name="singleLineAllowed">true</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.ForLoopChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.IfBraceChecker" level="warning">
<parameters>
<parameter name="singleLineAllowed">true</parameter>
<parameter name="doubleLineAllowed">true</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.IllegalImportsChecker" level="warning">
<parameters>
<parameter name="illegalImports">sun._,java.awt._</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.ImportGroupingChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.ImportOrderChecker" level="warning">
<parameters>
<parameter name="groups">java,scala,parsley,parsley.internal,others</parameter>
<parameter name="group.java">javax?\..+</parameter>
<parameter name="group.scala">scala\..+</parameter>
<parameter name="group.parsley">parsley\.(?!internal).+</parameter>
<parameter name="group.parsley.internal">parsley\.internal\..+</parameter>
<parameter name="group.others">.+</parameter>
</parameters>
</check>
<check enabled="false" class="org.scalastyle.scalariform.LowercasePatternMatchChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.MagicNumberChecker" level="warning">
<parameters>
<parameter name="ignore">-1,0,1,2,3,8,10,16</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.MethodArgumentNamesChecker" level="warning">
<parameters>
<parameter name="regex">^_?[a-z][A-Za-z0-9]*_?$</parameter>
<parameter name="ignoreRegex">^$</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.MethodLengthChecker" level="warning">
<parameters>
<parameter name="maxLength">50</parameter>
<parameter name="ignoreComments">true</parameter>
</parameters>
</check>
<!-- This is obviously a no-go, although we could add the combinators here explicitly to exclude them? -->
<check enabled="false" class="org.scalastyle.scalariform.MethodNamesChecker" level="warning">
<parameters>
<parameter name="regex">^[a-z][A-Za-z0-9]*$</parameter>
<parameter name="ignoreRegex">^$</parameter>
<parameter name="ignoreOverride">false</parameter>
</parameters>
</check>
<check enabled="false" class="org.scalastyle.scalariform.MultipleStringLiteralsChecker" level="warning">
<parameters>
<parameter name="allowed">1</parameter>
<parameter name="ignoreRegex">^\"\"$</parameter>
</parameters>
</check>
<!-- We use quite a lot of these, and I'm not sure I want to change the styling over right now. -->
<check enabled="false" class="org.scalastyle.scalariform.NamedArgumentChecker" level="warning">
<parameters>
<parameter name="checkString">false</parameter>
<parameter name="ignoreMethod">^set.+$</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.NoCloneChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.NoFinalizeChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.NoWhitespaceBeforeRightBracketChecker" level="warning"/>
<!-- We use a special ' type, so this is out the window! -->
<check enabled="false" class="org.scalastyle.scalariform.NonASCIICharacterChecker" level="warning">
<parameters>
<parameter name="allowStringLiterals">true</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.NotImplementedErrorUsage" level="warning"/>
<!-- We use null for the stack bases -->
<check enabled="false" class="org.scalastyle.scalariform.NullChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" level="warning">
<parameters>
<parameter name="maxMethods">50</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.NumberOfTypesChecker" level="warning">
<parameters>
<parameter name="maxTypes">30</parameter>
</parameters>
</check>
<!-- We don't want this, becasue we have combinator-based class names and module names with lowercase -->
<check enabled="false" class="org.scalastyle.scalariform.ObjectNamesChecker" level="warning">
<parameters>
<parameter name="regex">^[A-Z][A-Za-z]*$</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.OverrideJavaChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.PackageNamesChecker" level="warning">
<parameters>
<parameter name="regex">^[a-z][A-Za-z]*$</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.PackageObjectNamesChecker" level="warning">
<parameters>
<parameter name="regex">^[a-z][A-Za-z]*$</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.ParameterNumberChecker" level="warning">
<parameters>
<parameter name="maxParameters">8</parameter>
</parameters>
</check>
<!-- Too fiddly, only if it allowed for same line alignment only... -->
<check enabled="false" class="org.scalastyle.scalariform.PatternMatchAlignChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.ProcedureDeclarationChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.RedundantIfChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.ReturnChecker" level="warning"/>
<!-- As nice as it would be, there are too many classes that would need to go in the ignore Regex: maybe in the future -->
<check enabled="false" class="org.scalastyle.scalariform.ScalaDocChecker" level="warning">
<parameters>
<parameter name="ignoreRegex"></parameter>
<parameter name="ignoreTokenTypes"></parameter>
<parameter name="ignoreOverride">false</parameter>
<parameter name="indentStyle">scaladoc</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.SpacesAfterPlusChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.SpacesBeforePlusChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.StructuralTypeChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.ThrowChecker" level="warning"/>
<!-- This seems to be broken right now? -->
<!--<check enabled="true" class="org.scalastyle.scalariform.TodoCommentChecker" level="warning">
<parameters>
<parameter name="words" type="string" default="FIXME"/>
</parameters>
<customMessage>Please fix any FIXMEs</customMessage>
</check>-->
<check enabled="false" class="org.scalastyle.scalariform.TokenChecker" level="info">
<parameters>
<parameter name="regex">^[ai]sInstanceOf$</parameter>
</parameters>
<customMessage>Avoid casting.</customMessage>
</check>
<check enabled="true" class="org.scalastyle.scalariform.UnderscoreImportChecker" level="warning">
<parameters>
<parameter name="ignoreRegex">X(\w)*Compat|XAssert|Predef|singletons|lift</parameter>
</parameters>
</check>
<check enabled="true" class="org.scalastyle.scalariform.UppercaseLChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.scalariform.VarFieldChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.VarLocalChecker" level="warning"/>
<check enabled="true" class="org.scalastyle.scalariform.WhileBraceChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.scalariform.WhileChecker" level="warning"/>
<check enabled="false" class="org.scalastyle.scalariform.XmlLiteralChecker" level="warning"/>
</scalastyle>