forked from scalastyle/scalastyle
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scalastyle_documentation.xml
937 lines (846 loc) · 28.6 KB
/
scalastyle_documentation.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
<scalastyle-documentation>
<check id="file.size.limit">
<justification>
Files which are too long can be hard to read and understand.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.FileLengthChecker" enabled="true">
<parameters>
<parameter name="maxFileLength">800</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="line.size.limit">
<justification>
Lines that are too long can be hard to read and horizontal scrolling is annoying.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.FileLineLengthChecker" enabled="true">
<parameters>
<parameter name="maxLineLength" type="integer" default="100" />
<parameter name="tabSize" type="integer" default="2" />
<parameter name="ignoreImports" type="boolean" default="true" />
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="magic.number">
<justification>
Replacing a magic number with a named constant can make code easier to read and understand, and can avoid some subtle bugs.
</justification>
<extra-description>
A simple assignment to a val is not considered to be a magic number, for example:
val foo = 4
is not a magic number, but
var foo = 4
is considered to be a magic number.
</extra-description>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.MagicNumberChecker" enabled="true">
<parameters>
<parameter name="ignore">-1,0,1,2,3</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="regex">
<justification>
Some checks can be carried out with a regular expression.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters>
<parameter name="regex">(?m)^\s*$(\r|)\n^\s*$(\r|)\n</parameter>
<parameter name="line">false</parameter>
</parameters>
<customMessage>No double blank lines</customMessage>
</check>
]]>
</example-configuration>
</check>
<check id="number.of.types">
<justification>
If there are too many classes/objects defined in a single file, this can cause the code to be difficult to understand.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NumberOfTypesChecker" enabled="true">
<parameters>
<parameter name="maxTypes">20</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="cyclomatic.complexity">
<justification>
If the code is too complex, then this can make code hard to read.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="true">
<parameters>
<parameter name="maximum">10</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="uppercase.l">
<justification>
A lowercase L (l) can look similar to a number 1 with some fonts.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="if.brace">
<justification>
Some people find if clauses with braces easier to read.
</justification>
<extra-description>
The singleLineAllowed property allows if constructions of the type:
if (bool_expression) expression1 else expression2
The doubleLineAllowed property allows if constructions of the type:
if (bool_expression) expression1
else expression2
Note: If you intend to enable only if expressions in the format below, disable the IfBraceChecker altogether.
if (bool_expression)
expression1
else
expression2
</extra-description>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.IfBraceChecker" enabled="true">
<parameters>
<parameter name="singleLineAllowed">true</parameter>
<parameter name="doubleLineAllowed">false</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="method.length">
<justification>
Long methods can be hard to read and understand.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.MethodLengthChecker" enabled="true">
<parameters>
<parameter name="maxLength">50</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="method.name">
<justification>
The Scala style guide recommends that method names conform to certain standards. If the methods are overriding another method, and the overridden method
cannot be changed, then use the ignoreOverride parameter.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.MethodNamesChecker" enabled="true">
<parameters>
<parameter name="regex">^[A-Za-z]*$</parameter>
<parameter name="ignoreRegex">^.*$</parameter>
<parameter name="ignoreOverride">false</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="number.of.methods">
<justification>
If a type declares too many methods, this can be an indication of bad design.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="true">
<parameters>
<parameter name="maxMethods">30</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="public.methods.have.type">
<justification>
A public method declared on a type is effectively an API declaration. Explicitly declaring a return type means that other code which depends on that type won't break unexpectedly.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true">
<parameters>
<parameter name="ignoreOverride">false</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="newline.at.eof">
<justification>
Some version control systems don't cope well with files which don't end with a newline character.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.NewlineAtEofChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="no.newline.at.eof">
<justification>
Because Mirco Dotta wanted it.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.NoNewlineAtEofChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="while">
<justification>
while loops are deprecated if you're using a strict functional style
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.WhileChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="var.field">
<justification>
var (mutable fields) are deprecated if you're using a strict functional style
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.VarFieldChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="var.local">
<justification>
vars (mutable local variables) loops are deprecated if you're using a strict functional style
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.VarLocalChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="if.redundant">
<justification>
If expressions with boolean constants in both branches can be eliminated without affecting readability. Prefer simply `cond` to `if (cond) true else false` and `!cond` to `if (cond) false else true`.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.RedundantIfChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="token">
<justification>
Some checks can be carried by just the presence of a particular token.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.TokenChecker" enabled="true">
<parameters>
<parameter name="regex">^[ai]sInstanceOf$</parameter>
</parameters>
<customMessage>Avoid casting.</customMessage>
</check>
]]>
</example-configuration>
</check>
<check id="deprecated.java">
<justification>
You should be using the Scala @deprecated instead.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.DeprecatedJavaChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="empty.class">
<justification>
If a class / trait has no members, then braces are unnecessary, and can be removed.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.EmptyClassChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="class.type.parameter.name">
<justification>
Scala generic type names are generally single upper case letters. This check checks for classes and traits.
Note that this check only checks the innermost type parameter, to allow for List\[T\].
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ClassTypeParameterChecker" enabled="true">
<parameters>
<parameter name="regex">^[A-Z_]$</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="underscore.import">
<justification>
Importing all classes from a package or static members from a class leads to tight coupling between packages or classes and might lead to problems when a new version of a library introduces name clashes.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.UnderscoreImportChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="lowercase.pattern.match">
<justification>
A lower case pattern match clause with no other tokens is the same as \_; this is not true for patterns which start with an upper
case letter. This can cause confusion, and may not be what was intended:
val foo = "foo"
val Bar = "bar"
"bar" match { case Bar => "we got bar" } // result = "we got bar"
"bar" match { case foo => "we got foo" } // result = "we got foo"
"bar" match { case `foo` => "we got foo" } // result = MatchError
This checker raises a warning with the second match. To fix it, use an identifier which starts with an upper case letter (best), use case \_ or,
if you wish to refer to the value, add a type `: Any`
val lc = "lc"
"something" match { case lc: Any => "lc" } // result = "lc"
"something" match { case _ => "lc" } // result = "lc"
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.LowercasePatternMatchChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="multiple.string.literals">
<justification>
Code duplication makes maintenance more difficult, so it can be better to replace the multiple occurrences with a constant.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.MultipleStringLiteralsChecker" enabled="true">
<parameters>
<parameter name="allowed">1</parameter>
<parameter name="ignoreRegex">^\"\"$</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="import.grouping">
<justification>
If imports are spread throughout the file, knowing what is in scope at any one place can be difficult to work out.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ImportGroupingChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="not.implemented.error.usage">
<justification>
The ??? operator denotes that an implementation is missing. This rule helps to avoid potential runtime errors because of not implemented code.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true" />
]]>
</example-configuration>
</check>
<check id="block.import">
<justification>
Block imports can lead to annoying merge errors in large code bases that are maintained by lot of developers. This rule allows to ensure that only single imports are used in order to minimize merge errors in import declarations.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.BlockImportChecker" enabled="true"/>
]]>
</example-configuration>
</check>
<check id="procedure.declaration">
<justification>
A procedure style declaration can cause confusion - the developer may have simply forgotten to add a '=', and now their method returns Unit rather than the inferred type:
def foo() { println("hello"); 5 }
def foo() = { println("hello"); 5 }
This checker raises a warning with the first line. To fix it, use an explicit return type, or add a '=' before the body.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ProcedureDeclarationChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="for.brace">
<justification>
Usage of braces (rather than parentheses) within a for comprehension mean that you don't have to specify a semi-colon at the end of every line:
for { // braces
t <- List(1,2,3)
if (i % 2 == 0)
} yield t
is preferred to
for ( // parentheses
t <- List(1,2,3);
if (i % 2 == 0)
) yield t
To fix it, replace the () with {}. And then remove the ; at the end of the lines.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ForBraceChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="space.after.comment.start">
<justification>
To bring consistency with how comments should be formatted, leave a space right after the beginning of the comment.
package foobar
object Foobar {
/**WRONG
*
*/
/** Correct*/
val d = 2 /*Wrong*/ //Wrong
/**
*Correct
*/
val e = 3/** Correct*/ // Correct
}
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="non.ascii.character.disallowed">
<justification>
Scala allows unicode characters as operators and some editors misbehave when they see non-ascii character.
In a project collaborated by a community of developers. This check can be helpful in such situations.
"value".match {
case "value" => println("matched")
...
}
is preferred to
"value".match {
case "value" ⇒ println("matched")
...
}
To fix it, replace the (unicode operator)⇒ with =>.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NonASCIICharacterChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="header.matches">
<justification>
A lot of projects require a header with a copyright notice, or they require a license in each file. This does a simple text comparison between the header and the first lines of the file.
You can have multiple lines, but make sure you surround the text with a CDATA section. You can also specify a regular expression, as long as you set the regex parameter to true.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.HeaderMatchesChecker" enabled="true">
<parameters>
<parameter name="regex">false</parameter>
<parameter name="header"><![CDATA[// Copyright \(C\) 2011-2012 the original author or authors.]]]]><![CDATA[></parameter>
</parameters>
</check>
]]>
</example-configuration>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.HeaderMatchesChecker" enabled="true">
<parameters>
<parameter name="regex">true</parameter>
<parameter name="header"><![CDATA[// Copyright \(C\) (?:\d{4}-)?\d{4} the original author or authors.]]]]><![CDATA[></parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="field.name">
<justification>A consistent naming convention for field names can make code easier to read and understand</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.FieldNamesChecker" enabled="true">
<parameters>
<parameter name="regex">^[a-z][A-Za-z0-9]*$</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="xml.literal">
<justification>Some projects prefer not to have XML literals. They could use a templating engine instead.</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.XmlLiteralChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="todo.comment">
<justification>Some projects may consider TODO or FIXME comments in a code bad style. They would rather you fix the problem.</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.TodoCommentChecker" enabled="true">
<parameters>
<parameter name="words" type="string" default="TODO|FIXME" />
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="line.contains.tab">
<justification>Some say that tabs are evil.</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.FileTabChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="class.name">
<justification>
The Scala style guide recommends that class names conform to certain standards.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ClassNamesChecker" enabled="true">
<parameters>
<parameter name="regex">^[A-Z][A-Za-z]*$</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="object.name">
<justification>
The Scala style guide recommends that object names conform to certain standards.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ObjectNamesChecker" enabled="true">
<parameters>
<parameter name="regex">^[A-Z][A-Za-z]*$</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="package.name">
<justification>
The Scala style guide recommends that package names conform to certain standards.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.PackageNamesChecker" enabled="true">
<parameters>
<parameter name="regex">^[a-z][A-Za-z]*$</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="package.object.name">
<justification>
The Scala style guide recommends that package object names conform to certain standards.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true">
<parameters>
<parameter name="regex">^[a-z][A-Za-z]*$</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="null">
<justification>
Scala discourages use of nulls, preferring Option.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NullChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="return">
<justification>
Use of return is not usually necessary in Scala. In fact, use of return can discourage a functional style of programming.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ReturnChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="equals.hash.code">
<justification>
Defining either equals or hashCode in a class without defining the is a known source of bugs. Usually, when you define one, you should also define the other.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="structural.type">
<justification>
Structural types in Scala can use reflection - this can have unexpected performance consequences.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="no.clone">
<justification>
The clone method is difficult to get right. You can use the copy constructor of case classes rather than implementing clone.
For more information on clone(), see Effective Java by Joshua Bloch pages.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NoCloneChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="no.finalize">
<justification>
finalize() is called when the object is garbage collected, and garbage collection is not guaranteed to happen.
It is therefore unwise to rely on code in finalize() method.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="indentation">
<justification>
Code that is not indented consistently can be hard to read.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.IndentationChecker" enabled="true">
<parameters>
<parameter name="tabSize">2</parameter>
<parameter name="methodParamIndentSize">2</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="whitespace.end.of.line">
<justification>
Whitespace at the end of a line can cause problems when diffing between files or between versions.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="illegal.imports">
<justification>
Use of some classes can be discouraged for a project. For instance, use of sun._ is generally discouraged because
they are internal to the JDK and can be changed.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.IllegalImportsChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="parameter.number">
<justification>
A method which has more than a certain number of parameters can be hard to understand.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="true">
<parameters>
<parameter name="maxParameters">8</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="simplify.boolean.expression">
<justification>
A boolean expression which can be simplified can make code easier to read.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="spaces.before.plus">
<justification>
An expression with spaces around + can be easier to read
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.BeforePlusChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="spaces.after.plus">
<justification>
An expression with spaces around + can be easier to read
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="no.whitespace.before.left.bracket">
<justification>
If there is whitespace before a left bracket, this can be confusing to the reader
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="no.whitespace.after.left.bracket">
<justification>
If there is whitespace after a left bracket, this can be confusing to the reader
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="covariant.equals">
<justification>
Mistakenly defining a covariant equals() method without overriding method equals(java.lang.Object) can produce unexpected runtime behaviour.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true" />
]]>
</example-configuration>
</check>
<check id="scaladoc">
<justification>
Scaladoc is generally considered a good thing. Within reason.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ScalaDocChecker" enabled="true">
<parameters>
<parameter name="ignoreRegex">(.*Spec$)|(.*SpecIT$)</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="disallow.space.after.token">
<justification>
Correct formatting can help readability.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.DisallowSpaceAfterTokenChecker" enabled="true">
<parameters>
<parameter name="tokens">LPAREN</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="disallow.space.before.token">
<justification>
Correct formatting can help readability.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.DisallowSpaceBeforeTokenChecker" enabled="true">
<parameters>
<parameter name="tokens">COLON, COMMA, RPAREN</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="ensure.single.space.after.token">
<justification>
Correct formatting can help readability.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.EnsureSingleSpaceAfterTokenChecker" enabled="true">
<parameters>
<parameter name="tokens">COLON, IF</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="ensure.single.space.before.token">
<justification>
Correct formatting can help readability.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.EnsureSingleSpaceBeforeTokenChecker" enabled="true">
<parameters>
<parameter name="tokens">LPAREN</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="import.ordering">
<justification>
Consistent import ordering improves code readability and reduces unrelated changes in patches.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.ImportOrderChecker" enabled="true">
<parameters>
<parameter name="groups">java,scala,others</parameter>
<parameter name="group.java">javax?\..+</parameter>
<parameter name="group.scala">scala\..+</parameter>
<parameter name="group.others">.+</parameter>
</parameters>
</check>
]]>
</example-configuration>
</check>
<check id="pattern.match.align">
<justification>
Correct formatting can help readability.
</justification>
<example-configuration>
<![CDATA[
<check level="warning" class="org.scalastyle.scalariform.PatternMatchAlignChecker" enabled="true"/>
]]>
</example-configuration>
</check>
</scalastyle-documentation>