-
Notifications
You must be signed in to change notification settings - Fork 1
/
google_checks_description.xml
1471 lines (1252 loc) · 44.9 KB
/
google_checks_description.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
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.org (or in your downloaded distribution).
To completely disable a check, just comment it out or delete it from the file.
To suppress certain violations please review suppression filters.
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
-->
<module name = "Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!--
https://checkstyle.sourceforge.io/config_filefilters.html#BeforeExecutionExclusionFileFilter
checkstyle 제외할 파일 설정
-->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_filters.html#SuppressionFilter
-->
<module name="SuppressionFilter">
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
default="checkstyle-suppressions.xml" />
<property name="optional" value="true"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#FileTabCharacter
탭 문자가 있는지 검사
-->
<module name="FileTabCharacter">
<!-- eachLine=true 탭 문자가 들어있는 모든 Line에 대해 보고함 -->
<!-- eachLine=false 탭 문자가 들어있는 첫 Line에 대해서만 보고함 -->
<property name="eachLine" value="true"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_sizes.html#LineLength
한 줄당 캐릭터 수 제한
-->
<module name="LineLength">
<!-- 적용할 확장자 -->
<property name="fileExtensions" value="java"/>
<!-- 캐릭터 수 제한 값 설정 -->
<property name="max" value="100"/>
<!-- Ignore -->
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<!--
https://checkstyle.sourceforge.io/config_misc.html#OuterTypeFilename
/* bad */
// Apple.java
class Banana {
}
/* good */
// Apple.java
class Apple {
}
-->
<module name="OuterTypeFilename"/>
<!--
https://checkstyle.sourceforge.io/config_coding.html#IllegalTokenText
/* bad */
char tab = '\u0009';
/* bad */
char octalTab = '\011';
/* good */
char escapedSequenceTab = '\t';
-->
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_misc.html#AvoidEscapedUnicodeCharacters
/* bad */
String unicode = "\u03BCS";
/* allow by allowEscapesForControlCharacters */
String unicode = "\u200E";
/* allow by allowByTailComment */
String unicode = "\u03BCS"; // the reader has no idea what this is.
/* allow by allowNonPrintableEscapes */
String unicode = "\u0020";
/* good */
String unitAbbrev = "μs";
-->
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_imports.html#AvoidStarImport
/* bad */
import net.spy.memcached.*;
/* good */
import net.spy.memcached.ArcusClient;
-->
<module name="AvoidStarImport"/>
<!--
https://checkstyle.sourceforge.io/config_design.html#OneTopLevelClass
/* bad */
// Parent.java
class Parent {
}
class Child {
}
/* good */
// Parent.java
class Parent {
}
// Child.java
class Child {
}
-->
<module name="OneTopLevelClass"/>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#NoLineWrap
/* bad by PACKAGE_DEF */
package com.puppycrawl.
tools.checkstyle.checks;
/* bad by IMPORT */
import com.puppycrawl.tools.
checkstyle.api.AbstractCheck;
/* bad by STATIC_IMPORT */
import static java.math.
BigInteger.ZERO;
/* good */
package com.puppycrawl.tools.checkstyle.checks;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import static java.math.BigInteger.ZERO;
-->
<module name="NoLineWrap">
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_blocks.html#EmptyBlock
/* bad */
if (a==b) {
// empty block
} else {
System.out.println("not equal");
}
/* good */
if (a==b) {
System.out.println("equal");
} else {
System.out.println("not equal");
}
-->
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_blocks.html#NeedBraces
/* bad */
if (a==b)
System.out.println("equal");
else
System.out.println("not equal");
/* good */
if (a==b) {
System.out.println("equal");
} else {
System.out.println("not equal");
}
-->
<module name="NeedBraces">
<property name="tokens"
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_blocks.html#LeftCurly
/* bad */
if (1==1)
{
System.out.println("equal");
}
else
{
System.out.println("not equal");
}
/* good */
if (1==1) {
System.out.println("equal");
} else {
System.out.println("not equal");
}
-->
<module name="LeftCurly">
<property name="tokens"
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
OBJBLOCK, STATIC_INIT"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_blocks.html#RightCurly
/* bad */
if (a==b) {
System.out.println("equal"); }
else {
System.out.println("not equal"); }
/* good */
if (1==1) {
System.out.println("equal");
} else {
System.out.println("not equal");
}
-->
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_filters.html#SuppressionXpathSingleFilter
-->
<module name="SuppressionXpathSingleFilter">
<property name="id" value="RightCurlyAlone"/>
<property name="query" value="//RCURLY[parent::SLIST[count(./*)=1]
or preceding-sibling::*[last()][self::LCURLY]]"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#WhitespaceAround
/* allow by allowEmptyConstructors */
public MyClass() {}
/* allow by allowEmptyLambdas */
Runnable noop = () -> {}
/* allow by allowEmptyMethods */
public void func() {}
/* allow by allowEmptyTypes */
public class Alpha {}
public @interface Beta {}
/* allow by allowEmptyLoops */
for (int i = 1; i > 1; i++) {}
/* bad */
void method(){
}
/* good */
void method() {
}
/* bad */
try {
String str = null;
str.isEmpty();
} catch (NullPointerException e1) {} catch (IllegalStateException e2) {}
/* good */
try {
String str = null;
str.isEmpty();
} catch (NullPointerException e1) {
} catch (IllegalStateException e2) { }
/* bad */
if (a==b) {
}
/* good */
if (a == b) {
}
-->
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="false"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_coding.html#OneStatementPerLine
/* bad */
int var1 = 1;
int var2 = 2;
var1++; var2++;
/* good */
int var = 1, var2 = 2;
var1++;
var2++;
-->
<module name="OneStatementPerLine"/>
<!--
https://checkstyle.sourceforge.io/config_coding.html#MultipleVariableDeclarations
/* bad */
int foo, bar, fooarray[];
/* good */
int foo;
int bar;
int[] fooarray;
-->
<module name="MultipleVariableDeclarations"/>
<!--
https://checkstyle.sourceforge.io/config_misc.html#ArrayTypeStyle
/* bad */
int[] nums;
String strings[];
/* good */
int[] nums;
String[] strings;
-->
<module name="ArrayTypeStyle"/>
<!--
https://checkstyle.sourceforge.io/config_coding.html#MissingSwitchDefault
/* bad */
switch (i) {
case 1:
break;
case 2:
break;
}
/* good */
switch (i) {
case 1:
break;
case 2:
break;
default:
break;
}
-->
<module name="MissingSwitchDefault"/>
<!--
https://checkstyle.sourceforge.io/config_coding.html#FallThrough
/* bad */
int i = 0;
switch (i) {
case 0:
i++;
case 1:
i++;
case 2:
case 3: {
i++;
}
default:
break;
}
/* good */
int i = 0;
switch (i) {
case 0:
i++;
// fall through
case 1:
i++;
// fall through
case 2:
case 3: {
i++;
}
// fall through
default:
break;
}
-->
<module name="FallThrough">
<property name="reliefPattern" value="falls?[ -]?thr(u|ough)"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_misc.html#UpperEll
/* bad */
long value = 100l
/* good */
long value = 100L
-->
<module name="UpperEll"/>
<!--
https://checkstyle.sourceforge.io/config_modifier.html#ModifierOrder
1. public
2. protected
3. private
4. abstract
5. default
6. static
7. final
8. transient
9. volatile
10. synchronized
11. native
12. strictfp
/* bad */
abstract public void abstractPublicMethod();
/* good */
public abstract void publicAbstractMethod();
-->
<module name="ModifierOrder"/>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#EmptyLineSeparator
/* bad */
package com.jam2in.main;
import net.spy.memcached.ArcusClient;
public class Main {
public static void main(String[] args) {
}
public static void test() {
}
}
/* good */
package com.jam2in.main;
import net.spy.memcached.ArcusClient;
public class Main {
public static void main(String[] args) {
}
public static void test() {
}
}
-->
<module name="EmptyLineSeparator">
<property name="tokens"
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#SeparatorWrap
/* bad */
new ConnectionFactoryBuilder().
setAPIReadPriority(null).
build();
/* good */
new ConnectionFactoryBuilder()
.setAPIReadPriority(null)
.build();
-->
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#SeparatorWrap
/* bad */
System.out.printf(
"%d %d %d"
,1
,2
,3
);
/* good */
System.out.printf(
"%d %d %d",
1,
2,
3
);
-->
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#SeparatorWrap
/* bad */
public static void printf(
String
arg1,
Object
...arg2) { }
/* good */
public static void printf(
String
arg1,
Object...
arg2) { }
-->
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapEllipsis"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="option" value="EOL"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#SeparatorWrap
/* bad */
int
[]array;
/* good */
int[]
array;
-->
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapArrayDeclarator"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="option" value="EOL"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#SeparatorWrap
/* bad */
Arrays.sort(stringArray, String::
compareToIgnoreCase);
/* good */
Arrays.sort(stringArray, String
::compareToIgnoreCase);
-->
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapMethodRef"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#PackageName
/* bad */
package COM;
package com.A.checkstyle.checks;
package com.checkSTYLE.checks;
package com._checkstyle.checks_;
/* good */
package com;
package com.checkstyle.checks;
package com.checkstyle1.checks;
-->
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#TypeName
/* bad */
class myClass {
}
/* good */
class MyClass {
}
-->
<module name="TypeName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF"/>
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#MemberName
/* bad */
public int NUM1;
protected int NUM2;
final int NUM3;
private int NUM4;
/* ignored */
static int NUM5 = 0;
static int num6 = 0;
/* good */
public int num1;
protected int num2;
final int num3 = 3;
private int num4;
-->
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#ParameterName
/* bad */
void method2(int v_2) {
}
void method3(int V3) {
}
/* good */
void method1(int v1) {
}
-->
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#LambdaParameterName
/* bad */
Function<String, String> function2 = S -> S.toLowerCase();
/* good */
Function<String, String> function1 = s -> s.toLowerCase();
-->
<module name="LambdaParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#CatchParameterName
/* bad */
try {
} catch (ArithmeticException ex1) {
} catch (ArrayIndexOutOfBoundsException EX2) {
}
/* good */
try {
} catch (ArithmeticException ex1) {
} catch (ArrayIndexOutOfBoundsException ex2) {
}
-->
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#LocalVariableName
/* bad */
int v_1;
int V2;
/* good */
int v1;
int v2;
-->
<module name="LocalVariableName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#ClassTypeParameterName
/* bad */
class MyClass<t> { }
/* good */
class MyClass<T> { }
-->
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#MethodTypeParameterName
/* bad */
public <a> void method() { }
/* good */
public <T> void method() { }
-->
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#InterfaceTypeParameterName
/* bad */
interface FirstInterface<t> { }
/* good */
interface SecondInterface<T> { }
-->
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_coding.html#NoFinalizer
/* bad */
@Override
protected void finalize() throws Throwable {
super.finalize();
}
-->
<module name="NoFinalizer"/>
<!--
https://checkstyle.sourceforge.io/config_whitespace.html#GenericWhitespace
/* bad */
List <String> list;
List<String>list;
List< String> list;
List<String > list;
public< X, Y >X hello(X x, Y y) {
return null;
}
/* good */
List<String> list = new ArrayList<String>();
public <X, Y> X hello(X x, Y y) {
return null;
}
-->
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<!--
https://checkstyle.sourceforge.io/config_misc.html#Indentation
-->
<module name="Indentation">
<!--
/* bad */
class Main {
void main() {
}
}
/* good */
class Main {
void main() {
}
}
-->
<property name="basicOffset" value="2"/>
<!--
/* bad */
void main() {
}
/* good */
void main() {
}
-->
<property name="braceAdjustment" value="0"/>
<!--
/* bad */
int c = 100;
switch (c) {
case 0:
break;
case 1:
break;
default:
break;
}
/* good */
int c = 100;
switch (c) {
case 0:
break;
case 1:
break;
default:
break;
}
-->
<property name="caseIndent" value="2"/>
<!--
/* bad */
public static void main(String[] args) throws
IOException {
}
/* good */
public static void main(String[] args) throws
IOException {
}
-->
<property name="throwsIndent" value="4"/>
<!--
/* bad */
if ((1 == 1)
&& (2 == 2)) {
System.out.println("equal");
}
/* good */
if ((1 == 1)
&& (2 == 2)) {
System.out.println("equal");
}
-->
<property name="lineWrappingIndentation" value="4"/>
<!--
/* bad */
int[] arr = {
5,
6
};
/* good */
int[] arr = {
5,
6
};
-->
<property name="arrayInitIndent" value="2"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_naming.html#AbbreviationAsWordInName
/* bad */
int firstNUM;
int secondNUm;
/* good */
int firstNum;
int secondNum;
int thirdNUm; // allowedAbbrevitationLength=1
String firstXML; // abbreviation is allowed
String firstURL; // abbreviation is allowed
-->
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/>
</module>
<!--
https://checkstyle.sourceforge.io/config_coding.html#OverloadMethodsDeclarationOrder
/* bad */
public void foo(int i) { }
public void foo(String s) { }
public void notFoo() { }
public void foo(int i, String s) { }
/* good */
public void foo(int i) { }
public void foo(String s) { }
public void foo(int i, String s) { }
public void notFoo() { }
-->
<module name="OverloadMethodsDeclarationOrder"/>
<!--
https://checkstyle.sourceforge.io/config_coding.html#VariableDeclarationUsageDistance
/* bad */
int a = 0;
int b = 0;
int count;
a = a + b; // A distance is 3 : OK
b = a + a; // B distance is 3 : OK
int c;
count = b; // count distance is 4 : NOT OK
/* good */
int a = 0;
int b = 0;
int count;
a = a + b; // A distance is 3 : OK
b = a + a; // B distance is 3 : OK
count = b; // count distance is 3 : OK
-->
<module name="VariableDeclarationUsageDistance">
<property name="allowedDistance" value="3"/>
</module>
<!--