-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathcheckstyle.xml
115 lines (94 loc) · 3.83 KB
/
checkstyle.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
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration customized for my code style preferences.
This configuration enforces the following:
- Proper indentation (4 spaces)
- No unnecessary trailing spaces
- Maximum line length of 120 characters
- Consistent brace style (Allman)
- Proper whitespace usage
- Enforcement of basic Java best practices without adhering strictly to official conventions.
-->
<module name="Checker">
<module name="SuppressionFilter">
<property name="file" value="checkstyle_suppression.xml" />
</module>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Exclude module-info.java files as they are not needed for validation -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module-info\.java$"/>
</module>
<!-- Ensure files end with a newline -->
<module name="NewlineAtEndOfFile"/>
<!-- Enforce maximum file length -->
<module name="FileLength"/>
<!-- Maximum line length set to 150 characters -->
<module name="LineLength">
<property name="max" value="150"/>
</module>
<!-- Disallow tab characters, enforce 4-space indentation -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker">
<!-- Enforce brace style (K&R), which starts a block on the same line as the control statement -->
<module name="LeftCurly">
<property name="option" value="nl"/>
</module>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<!-- Enforce indentation -->
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
<!-- Enforce no empty blocks without comments -->
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<!-- Suppression via comments -->
<module name="SuppressionCommentFilter"/>
<!-- No unused imports -->
<module name="UnusedImports"/>
<!-- Checks for naming conventions -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Enforce spacing around operators -->
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
</module>
<!-- Additional whitespace rules to avoid inconsistent formatting -->
<module name="WhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="ParenPad"/>
<!-- Ensure a blank line exists between class definitions and members -->
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<!-- No multiple variable declarations in a single line -->
<module name="MultipleVariableDeclarations"/>
<!-- Ensure proper method design and code clarity -->
<module name="FinalClass"/>
</module>
</module>