forked from Facsimile/facsimile
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scalastyle-config.xml
851 lines (654 loc) · 35.3 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
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
<?xml version="1.0" encoding="UTF-8"?>
<!--====================================================================================================================
Facsimile: A Discrete-Event Simulation Library
Copyright © 2004-2020, Michael J Allen.
This file is part of Facsimile.
Facsimile is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.
Facsimile is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with Facsimile. If not, see:
http://www.gnu.org/licenses/lgpl.
The developers welcome all comments, suggestions and offers of assistance. For further information, please visit the
project home page at:
http://facsim.org/
Thank you for your interest in the Facsimile project!
IMPORTANT NOTE: All patches (modifications to existing files and/or the addition of new files) submitted for
inclusion as part of the official Facsimile code base, must comply with the published Facsimile Coding Standards. If
your code fails to comply with the standard, then your patches will be rejected. For further information, please
visit the coding standards at:
http://facsim.org/Documentation/CodingStandards/
===================================================================================================================-->
<!--====================================================================================================================
XML configuration file for Scalastyle.
The rules defined in this file enforce - to the maximum extent possible - Facsimile coding conventions and styles.
Whenever feasible, you should modify failing code so that it conforms to these rules.
However, occasionally there is no option but to disable certain rules. For example, you may need to pass a null value
to a Java API function. In this case, the rule should be disabled locally in your code via a "//scalastyle" comment.
Typically, such rules will be categorized here as having a level of "warning" rather than "error"; you should not
normally locally-disable error category rules.
When locally disabling rules, try to be as specific as possible so that other coders understand which rule is being
disabled. You should also add comments that explain why it was necessary. Avoid disabling all rules.
Rules that accept Scalariform tokens should refer to the following link for a list of supported token names:
https://github.com/scala-ide/scalariform/blob/master/scalariform/src/main/scala/scalariform/lexer/Tokens.scala
UNDER NO CIRCUMSTANCES SHOULD YOU DISABLE A RULE IN THIS FILE IN ORDER TO ALLOW YOUR CODE TO PASS SCALASTYLE
INSPECTIONS.
===================================================================================================================-->
<scalastyle>
<name>Facsimile project standard Scalastyle configuration</name>
<!--
Horizontal tab characters are completely forbidden in source files.
Rationale: tabs are rendered inconsistently across source file editors. If used, this results in improperly indented
sources when switching to a different editor, or when a different user employs the same editor with a different tab
configuration. The only means of avoiding "tab hell" is to completely forbid the use of tabs, and insist on spaces
instead.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.file.FileTabChecker" enabled="true" level="error" />
<!--
Ensure consistence line indentation.
NOTE: The tabSize parameter defines the number of spaces for each indentation; it does not refer to the width of the
TAB character.
Rationale: Lines that are indented incorrectly make it harder to work with. The Facsimile convention is that changes
in indentation only occur after a brace; that is, indentation increases after a left brace ('{'), and decreases after
a right brace ('}').
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.file.IndentationChecker" enabled="true" level="error">
<parameters>
<parameter name="tabSize">2</parameter>
<parameter name="methodParamIndentSize">0</parameter>
<parameter name="classParamIndentSize">0</parameter>
</parameters>
</check>
<!--
Trailing whitespace is forbidden at the end of each source line.
Rationale: Trailing whitespace is untidy and can lead to version control issues - particularly during merges.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true" level="error">
<parameters>
<parameter name="ignoreWhitespaceLines">false</parameter>
</parameters>
</check>
<!--
Source line lengths cannot exceed 120 characters.
Rationale: Originally, Facsimile forbid source files from having lines longer than 79 characters, on the basis that
this would cause wrapping of output on command prompt windows, terminals and printers. Also, shorter maximum line
lengths permit source diffs to be viewed side-by-side. There is an ergonomic argument that shorter lines are easier to
read than longer lines. However, Scala source files typically benefit from longer source line length, and modern PC &
tablet screens readily accommodate such files. A common convention in the Scala community is to allow 120 character
line lengths, and this convention has been adopted by Facsimile.
Note: When calculating line lengths, tabs are treated as being 8 characters wide, which is the default for most
terminals and printers. Tab characters, however, should not be present in source files (see FileTabChecker rule for
further details).
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.file.FileLineLengthChecker" enabled="true" level="error">
<parameters>
<parameter name="maxLineLength">120</parameter>
<parameter name="tabSize">8</parameter>
<parameter name="ignoreImports">false</parameter>
</parameters>
</check>
<!--
Source files must never contain two adjacent blank lines.
Note: This rules is implemented using the RegexChecker, and matches Windows, DOS, OS/2, MacOS v10+, UNIX, BSD and
Linux line terminator sequences.
Rationale: Multiple consecutive lank lines are unnecessary and require more scrolling in order to browse files. This
rule ensures that multiple blank lines can be detected and forbidden.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.file.RegexChecker" enabled="true" level="error">
<parameters>
<parameter name="regex"><![CDATA[\r?\n\r?\n\r?\n]]></parameter>
<parameter name="line">false</parameter>
</parameters>
<customMessage>Multiple blank lines are forbidden.</customMessage>
</check>
<!--
Each source file must commence with a standard header.
Rationale: The header is required to ensure that all sources have a correct copyright and distribution notice, which
must be up-to-date and valid for all sources.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.file.HeaderMatchesChecker" enabled="true" level="error">
<parameters>
<parameter name="regex">true</parameter>
<parameter name="header"><![CDATA[^//={118}\Q
// Facsimile: A Discrete-Event Simulation Library
// Copyright © 2004-\E\d{4}\Q, Michael J Allen.
//
// This file is part of Facsimile.
//
// Facsimile is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// Facsimile is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License along with Facsimile. If not, see:
//
// http://www.gnu.org/licenses/lgpl.
//
// The developers welcome all comments, suggestions and offers of assistance. For further information, please visit the
// project home page at:
//
// http://facsim.org/
//
// Thank you for your interest in the Facsimile project!
//
// IMPORTANT NOTE: All patches (modifications to existing files and/or the addition of new files) submitted for
// inclusion as part of the official Facsimile code base, must comply with the published Facsimile Coding Standards. If
// your code fails to comply with the standard, then your patches will be rejected. For further information, please
// visit the coding standards at:
//
// http://facsim.org/Documentation/CodingStandards/
//\E={118}\Q
//\E={118}\Q
// Scala source file belonging to the org.facsim.\E[\p{Lower}\d_\.]+\Q package.
//\E={118}\Q
package org.facsim\E[\p{Lower}\d_\.]*]]></parameter>
</parameters>
</check>
<!--
Ensure that ScalaDoc is correctly formed.
Rationale: Incorrectly formed ScalaDoc is a problem. Typically, this rule should only be disabled in test sources.
Note: The current ScalaDoc style guidelines recommend the indent style that is labeled "javadoc". However, that does
not fully support the standard (simple ScalaDoc comments in particular). Fortunately, IndentationChecker validates
standard format comments. For further details, refer to http://docs.scala-lang.org/style/scaladoc.html.
To disable this rule locally, use the ID: scaladoc
-->
<check class="org.scalastyle.scalariform.ScalaDocChecker" enabled="true" level="warning">
<parameters>
<parameter name="ignoreOverride">true</parameter>
<parameter name="indentStyle">anydoc</parameter>
</parameters>
</check>
<!--
Package names are lowercase letters with occasional underscores and digits. The first character must be a lowercase
character.
Rationale: This convention ensures a minimum of problems and should not be violated.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.PackageNamesChecker" enabled="true" level="error">
<parameters>
<parameter name="regex"><![CDATA[^\p{Lower}[\p{Lower}\d_]*$]]></parameter>
</parameters>
</check>
<!--
Package object names are lowercase letters with occasional underscores and digits. The first character must be a
lowercase character.
Rationale: This convention ensures a minimum of problems and should not be violated.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true" level="error">
<parameters>
<parameter name="regex"><![CDATA[^\p{Lower}[\p{Lower}\d_]*$]]></parameter>
</parameters>
</check>
<!--
Object names are alphanumeric, starting with an uppercase character.
Although it cannot be enforced by Scalastyle, the convention is that object names are also in camel case with no
underscores permitted.
Rationale: This is a common Scala convention that should not be violated without a very good reason.
To disable this rule locally, use the ID: object.name
-->
<check class="org.scalastyle.scalariform.ObjectNamesChecker" enabled="true" level="warning">
<parameters>
<parameter name="regex"><![CDATA[^\p{Upper}\p{Alnum}*$]]></parameter>
</parameters>
</check>
<!--
Class names are alphanumeric, starting with an uppercase character.
Although it cannot be enforced by Scalastyle, the convention is that class names are also in camel case with no
underscores permitted.
Rationale: This is a common Scala convention that should not be violated without a very good reason.
To disable this rule locally, use the ID: class.name
-->
<check class="org.scalastyle.scalariform.ClassNamesChecker" enabled="true" level="warning">
<parameters>
<parameter name="regex"><![CDATA[^\p{Upper}\p{Alnum}*$]]></parameter>
</parameters>
</check>
<!--
Field names are alphanumeric, starting with a lowercase character (except for constants, which start with a capital),
and may also contain underscores.
Although it cannot be enforced by Scalastyle, the convention is that field names are also in camel case with no
underscores permitted. A further unenforceable convention, is that "constants" (special values that have defined
values, that are of particular importance in pattern matching) start with a capital letter.
Note: Classes and traits use the "regex" regular expression for validation; objects use the "objectFieldRegex" regular
expression.
Rationale: This is a common Scala convention that should not be violated without a very good reason.
To disable this rule locally, use the ID: field.name
-->
<check class="org.scalastyle.scalariform.FieldNamesChecker" enabled="true" level="warning">
<parameters>
<parameter name="regex"><![CDATA[^\p{Alpha}\w*$]]></parameter>
<parameter name="objectFieldRegex"><![CDATA[^\p{Alpha}\w*$]]></parameter>
</parameters>
</check>
<!--
Class/trait(/object?) definitions that are empty should not have braces.
Rationale: Braces for such classes are redundant and need not be specified.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.EmptyClassChecker" enabled="true" level="error" />
<!--
Enforce use of a single uppercase character, with optional trailing digit, for the name of class/trait type
parameters.
Rationale: This is a common Scala convention that should not be violated without a very good reason.
To disable this rule locally, use the ID: class.type.parameter.name
-->
<check class="org.scalastyle.scalariform.ClassTypeParameterChecker" enabled="true" level="warning">
<parameters>
<parameter name="regex"><![CDATA[^\p{Upper}\p{Digit}*$]]></parameter>
</parameters>
</check>
<!--
Forbid the use of var fields.
Rationale: In strict functional programming, mutable fields are undesirable and lead to mutable state. Use of "var" is
occasionally necessary, in which case this check should be explicitly disabled.
To disable this rule locally, use the ID: var.field
-->
<check class="org.scalastyle.scalariform.VarFieldChecker" enabled="true" level="warning" />
<!--
Ensure that all classes defining a custom "equals" method also define a custom "hashCode" method, and vice versa.
Rationale: Class instances that are determined to be equal should have identical hash codes also. Consequently,
classes that have custom "equals" methods must have custom "hashCode" methods also.
To disable this rule locally, use the ID: equals.hash.code
-->
<check class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="true" level="warning" />
<!--
Ensure that all classes defining a custom "equals" method override "equals(java.lang.Object)".
Rationale: The Scala "==" equality operator utilizes the left operand class's "equals(java.lang.Object)" method, which
should be redefined if any custom "equals" method is required.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true" level="error" />
<!--
Ensure that no class defines a "clone" method.
Rationale: There is no point in cloning immutable objects, and cloning stateful objects should be a rare exception.
To disable this rule locally, use the ID: no.clone
-->
<check class="org.scalastyle.scalariform.NoCloneChecker" enabled="true" level="warning" />
<!--
Ensure that no class defines a "finalize" method.
Rationale: Finalize methods are unusual and are typically not required in practice, so any use of such functions is
most likely a mistake.
To disable this rule locally, use the ID: no.finalize
-->
<check class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true" level="warning" />
<!--
Ensure that Java-style "procedure"-style function declarations are not used.
For example,
def soSomething(arg: Int) {
//...
}
should be avoided, with one of the following preferred:
def doSomething(arg: Int): Unit = {
// ...
}
or (which should still be avoided, since it includes the possibility that a non-Unit value will be returned):
def doSomething(arg: Int) = {
// ...
}
Rationale: Martin Odersky has hinted many times that the procedure declaration syntax may be deprecated in a future
Scala release, as it is problematical and prevents the Scala compiler from trapping certain compile-time errors. It
would also reduce the confusion for new Scala developers. In the meantime, this Scalastyle warning is useful as it
forbids procedure syntax.
Refer to https://issues.scala-lang.org/browse/SI-7605 for further information.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.ProcedureDeclarationChecker" enabled="true" level="error"/>
<!--
Ensure valid method names.
Facsimile method names typically must not start with an uppercase character. Otherwise, the Scala compiler determines
whether method names are valid or not.
Rationale: This is a common Scala convention that should not be violated without a very good reason.
To disable this rule locally, use the ID: method.name
-->
<check class="org.scalastyle.scalariform.MethodNamesChecker" enabled="true" level="warning">
<parameters>
<parameter name="regex"><![CDATA[^[^\p{Upper}][^\s]*$]]></parameter>
<parameter name="ignoreRegex">^$</parameter>
<parameter name="ignoreOverride">false</parameter>
</parameters>
</check>
<!--
Ensure valid method argument names.
Hindsight method argument names typically must not start with an uppercase character. Otherwise, the Scala compiler
determines whether method names are valid or not.
Rationale: This is a common Scala convention that should not be violated without a very good reason.
To disable this rule locally, use the ID: method.argument.name
-->
<check class="org.scalastyle.scalariform.MethodArgumentNamesChecker" enabled="true" level="warning">
<parameters>
<parameter name="regex"><![CDATA[^[^\p{Upper}][^\s]*$]]></parameter>
<parameter name="ignoreRegex">^$</parameter>
</parameters>
</check>
<!--
Ensure that public methods specify their return value.
Rationale: Return value types of public methods are a fundamental part of the Facsimile API. It should not be left to
the Scala compiler to infer these types, as it is all too easy for them to change or to be defined incorrectly.
Consequently, it is essential that return types be specified explicitly.
TODO: Every public member must have an explicit type. IntelliJ enforces this, Scalastyle only enforces methods.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES. However, it may be necessary to disable it
in test sources, in which case it can be disabled with the ID: public.methods.have.type
-->
<check class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true" level="error">
<parameters>
<parameter name="ignoreOverride">false</parameter>
</parameters>
</check>
<!--
Enforce use of braces in if-else statements longer than one line.
Rationale: If a statement follows the if, or else, statement on the same line, then it is permitted not to require
braces. However, multiline if or else statements must have braces. This is because it can be hard to determine
visually whether a statement is conditional upon an if or else condition. For example:
if (found) println ("Search complete")
is OK, since it is clear that the println statement is dependent upon the if condition being true. However:
if (found)
println ("Search complete")
println (s"Item found was: $itemFound")
Is visually misleading, since only the first println statement is dependent upon the if condition being true. This
check would fail such a statement and would require it to be rewritten as:
if (found) {
println ("Search complete")
println (s"Item found was: $itemFound")
}
or as:
if (found) {
println ("Search complete")
}
println (s"Item found was: $itemFound")
as appropriate.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.IfBraceChecker" enabled="true" level="error">
<parameters>
<parameter name="singleLineAllowed">true</parameter>
<parameter name="doubleLineAllowed">true</parameter>
</parameters>
</check>
<!--
Warn against redundant if-else blocks.
For example, expressions such as:
if (cond) true else false
Should be replaced by simply:
cond
Rationale: Redundancy makes code more opaque and difficult to read.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.RedundantIfChecker" enabled="true" level="error" />
<!--
Enforce the use of braces over parentheses in for comprehensions.
That is, enforce:
for {
p <-people
if (p.isRetired)
} yield p
over
for (
p <- people;
if (p.isRetired)
) yield p
Rationale: The brace style is cleaner and does not require semicolons at the all but the last statement. Braces also
look more correct for multi-line code.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.ForBraceChecker" enabled="true" level="error" />
<!--
Flag complex Boolean expressions.
Rationale: Code that is overly complex and that can be simplified should be.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" enabled="true" level="error" />
<!--
Ensure that all long constants are denoted using an uppercase L.
Rationale: Lowercase Ls can appear indistinguisable from 1s in some fonts. By enforcing uppercase Ls, clarity reigns.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true" level="error" />
<!--
Require named constants instead of "magic numbers" in the code.
Rationale: Named constants are far more readable and self-documenting than mere numbers. (Numbers explicitly ignored
below are not treated as magic.)
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.MagicNumberChecker" enabled="true" level="error">
<parameters>
<parameter name="ignore">0,1,2</parameter>
</parameters>
</check>
<!--
Ensure interpolated strings are not empty.
Rationale: Empty interpolated strings are unnecessary and confusing; empty strings should not be interpolated.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.EmptyInterpolatedStringChecker" enabled="true" level="error"/>
<!--
Prevent string literals from appearing multiple times.
Note: Empty strings ("") are exempt from this rule.
Rationale: String literals that appear multiple times is a maintenance chore; such strings should be stored in a
constant value instead.
This should only be disabled in test code; UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR LIBRARY
SOURCES. To disable this rule locally (in test sources ONLY), use the ID: multiple.string.literals.
-->
<check class="org.scalastyle.scalariform.MultipleStringLiteralsChecker" enabled="true" level="error">
<parameters>
<parameter name="allowed">1</parameter>
<parameter name="ignoreRegex"><![CDATA[^""$]]></parameter>
</parameters>
</check>
<!--
Reject code that contains "???" values (not implemented statement).
Rationale: Leaving unimplemented code in commits is not good practice and will cause code rejection. However, the use
of "???" is strongly encouraged to document unimplemented features during development.
To disable this rule locally, use the ID: not.implemented.error.usage.
-->
<check class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true" level="warning" />
<!--
Prevent the use of structural typing.
Rationale: Structural typing requires reflection, which can impact performance unexpectedly. Structural typing is also
less elegant than inheritance. However, if it becomes absolutely necessary, this check can be locally disabled to
permit the use of structural typing.
To disable this rule locally, use the ID: structural.type
-->
<check class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true" level="warning"/>
<!--
Ensure that functions do not use local var declarations.
Rationale: In a purely functional programming style, mutable variables are not used. However, they can occasionally be
permitted for performance reasons, in which case this check can be locally disabled.
To disable this rule locally, use the ID: var.local
-->
<check class="org.scalastyle.scalariform.VarLocalChecker" enabled="true" level="warning" />
<!--
Ensure that while loops are not used.
Rationale: In a purely functional programming style, while loops typically require mutable state and can be replaced
by functional equivalents. However, they can occasionally be required for performance reasons, in which case this
check can be locally disabled.
To disable this rule locally, use the ID: while
-->
<check class="org.scalastyle.scalariform.WhileChecker" enabled="true" level="warning" />
<!--
Forbid the use of "return" statements in Scala.
Rationale: It is common Scala practice to strongly discourage use of the "return" statement (which begs the question,
"why does Scala even have a return statement?"). This check enforces the practice.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.ReturnChecker" enabled="true" level="error" />
<!--
Forbid the use of "null" values in Scala.
Rationale: The use of "null" reference values in Scala is strongly discouraged, and so the default is to require that
null is not utilized. Occasionally, particularly when dealing with Java APIs, it is necessary to use null values; so
this check should be explicitly disabled in such circumstances.
To disable this rule locally, use the ID: null
-->
<check class="org.scalastyle.scalariform.NullChecker" enabled="true" level="warning" />
<!--
Check lowercase-named values are not used in case expressions.
Rationale: Case statement matching is designed for constants, which are denoted by values beginning with an uppercase
name. If values with lowercase names are utilized, the results will be confusing.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.LowercasePatternMatchChecker" enabled="true" level="error" />
<!--
Enforce use of Scala @deprecated annotation over Java equivalent.
Rationale: Scala is not Java; there is no need to confuse Scala programmers with Java specific code.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.DeprecatedJavaChecker" enabled="true" level="error" />
<!--
Disable use of Java @Override annotation.
Rationale: Scala is not Java; in Scala, the override modifier should be used to override a class member. Use of the
@Override annotation is unnecessary and misleading.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.OverrideJavaChecker" enabled="true" level="error"/>
<!--
Guard against forbidden tokens, in this case use of asInstanceOf and isInstanceOf.
Rationale: Scala nearly always has a better alternative for these methods, so they are discouraged by default.
To disable this rule locally, use the ID: token
-->
<check class="org.scalastyle.scalariform.TokenChecker" enabled="true" level="warning">
<parameters>
<parameter name="regex"><![CDATA[^[ai]sInstanceOf$]]></parameter>
</parameters>
<customMessage>Casting methods are forbidden.</customMessage>
</check>
<!--
Ensure that there are no spaces prior to colons, commas, brackets or parentheses.
Rationale: This is simply an adopted Facsimile code style convention. It is enforced to ensure code consistency.
Note: Checking for no space before a left parenthesis is problematic. When defining argument lists (in both
declarations and calls), then no space should be present; however, when used for tuples or calculations, then a space
is often required for readability. A more sophisticated rule is required to check for spaces prior to left
parentheses, and so LPAREN is excluded from this list.
To disable this rule locally, use the ID: disallow.space.before.token
-->
<check class="org.scalastyle.scalariform.DisallowSpaceBeforeTokenChecker" enabled="true" level="warning">
<parameters>
<parameter name="tokens">COLON, COMMA, LBRACKET, RBRACKET, RPAREN</parameter>
</parameters>
</check>
<!--
Ensure that there are no spaces after left brackets and parentheses.
Rationale: This is simply an adopted Facsimile code style convention. It is enforced to ensure code consistency.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.DisallowSpaceAfterTokenChecker" enabled="true" level="error">
<parameters>
<parameter name="tokens">LBRACKET, LPAREN</parameter>
</parameters>
</check>
<!--
Ensure that there are spaces before specific tokens.
Rationale: This is simply an adopted Facsimile code style convention. It is enforced to ensure code consistency.
TODO: Currently disabled as we do not enforce spaces before tokens.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.EnsureSingleSpaceBeforeTokenChecker" enabled="false" level="error">
<parameters>
<parameter name="tokens"/>
</parameters>
</check>
<!--
Ensure that there are spaces after colons and commas.
Rationale: This is simply an adopted Facsimile code style convention. It is enforced to ensure code consistency.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.EnsureSingleSpaceAfterTokenChecker" enabled="true" level="error">
<parameters>
<parameter name="tokens">COLON, COMMA</parameter>
</parameters>
</check>
<!--
Ensure that code complexity is managable.
Complex code should be broken down into smaller components in order to simplify it.
Refer to https://en.wikipedia.org/wiki/Cyclomatic_complexity for further information.
Rationale: When code complexity becomes too high, it can become difficult to reason about, leading to a slower rate of
development and bugs. Code with high levels of cyclomatic complexity are also harder to test.
UNDER NO CIRCUMSTANCES MAY YOU LOCALLY DISABLE THIS RULE IN YOUR SOURCES.
-->
<check class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="true" level="error">
<parameters>
<parameter name="maximum">8</parameter>
<parameter name="countCases">true</parameter>
</parameters>
</check>
<!--
The following checks are not currently utilized by the Facsimile project.
-->
<check class="org.scalastyle.file.FileLengthChecker" enabled="false" level="error">
<parameters>
<parameter name="maxFileLength">800</parameter>
</parameters>
</check>
<check class="org.scalastyle.scalariform.BlockImportChecker" enabled="false" level="error"/>
<check class="org.scalastyle.scalariform.UnderscoreImportChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.ImportGroupingChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.IllegalImportsChecker" enabled="false" level="error">
<parameters>
<parameter name="illegalImports"><![CDATA[sun._,java.awt._]]></parameter>
</parameters>
</check>
<check class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="false" level="error">
<parameters>
<parameter name="maxParameters">8</parameter>
</parameters>
</check>
<check class="org.scalastyle.scalariform.NumberOfTypesChecker" enabled="false" level="error">
<parameters>
<parameter name="maxTypes">30</parameter>
</parameters>
</check>
<check class="org.scalastyle.scalariform.MethodLengthChecker" enabled="false" level="error">
<parameters>
<parameter name="maxLength"><![CDATA[50]]></parameter>
</parameters>
</check>
<check class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="false" level="error">
<parameters>
<parameter name="maxMethods"><![CDATA[30]]></parameter>
</parameters>
</check>
<check class="org.scalastyle.file.NewLineAtEofChecker" enabled="false" level="error" />
<check class="org.scalastyle.file.NoNewLineAtEofChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.ImportOrderChecker" enabled="false" level="error">
<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>
<check class="org.scalastyle.scalariform.NonASCIICharacterChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.PatternMatchAlignChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.SpacesBeforePlusChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.TodoCommentChecker" enabled="false" level="error">
<parameters>
<parameter default="TODO|FIXME" type="string" name="words" />
</parameters>
</check>
<check class="org.scalastyle.scalariform.XmlLiteralChecker" enabled="false" level="error" />
<check class="org.scalastyle.scalariform.NamedArgumentChecker" enabled="false" level="error">
<parameters>
<parameter name="checkString">false</parameter>
<parameter name="ignoreMethod">^set.+$</parameter>
</parameters>
</check>
<!--
The following checks are redundant (there are other checks that perform the exact same purpose, but which are more
generally applicable) and should not be enabled.
-->
<check class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" enabled="false" level="error"/>
<check class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" enabled="false" level="error"/>
<check class="org.scalastyle.scalariform.NoWhitespaceBeforeRightBracketChecker" enabled="false" level="error"/>
</scalastyle>