|
1 | 1 | <?xml version="1.0"?> |
2 | 2 | <!DOCTYPE module PUBLIC |
3 | | - "-//Puppy Crawl//DTD Check Configuration 1.3//EN" |
4 | | - "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> |
| 3 | + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" |
| 4 | + "https://checkstyle.org/dtds/configuration_1_3.dtd"> |
5 | 5 |
|
6 | | -<!-- Based on sun_checks.xml (V8.2) --> |
| 6 | +<!-- Based on sun_checks.xml (V8.30) --> |
7 | 7 |
|
8 | 8 | <!-- |
9 | 9 | Checkstyle configuration that checks the sun coding conventions from: |
|
15 | 15 | - the JDK Api documentation https://docs.oracle.com/en/java/javase/11/ |
16 | 16 | - some best practices |
17 | 17 | Checkstyle is very configurable. Be sure to read the documentation at |
18 | | - http://checkstyle.sourceforge.net (or in your downloaded distribution). |
| 18 | + https://checkstyle.org (or in your downloaded distribution). |
19 | 19 | Most Checks are configurable, be sure to consult the documentation. |
20 | 20 | To completely disable a check, just comment it out or delete it from the file. |
| 21 | + To suppress certain violations please review suppression filters. |
21 | 22 | Finally, it is worth reading the documentation. |
22 | 23 | --> |
23 | 24 |
|
|
28 | 29 | https://checkstyle.org/5.x/config.html#Checker |
29 | 30 | <property name="basedir" value="${basedir}"/> |
30 | 31 | --> |
| 32 | + <property name="severity" value="error"/> |
31 | 33 |
|
32 | | - |
33 | | - <!-- BorderTech Filter out Checkstyle warnings that have been suppressed with the @SuppressWarnings annotation --> |
| 34 | + <!-- BorderTech: Filter out Checkstyle warnings that have been suppressed with the @SuppressWarnings annotation. --> |
| 35 | + <!-- SuppressWarningsFilter and SuppressWarningsHolder have to be used together. --> |
34 | 36 | <module name="SuppressWarningsFilter" /> |
35 | 37 |
|
36 | | - <!-- BorderTech |
| 38 | + <!-- BorderTech: only check java files |
37 | 39 | <property name="fileExtensions" value="java, properties, xml"/> |
38 | 40 | --> |
39 | 41 | <property name="fileExtensions" value="java"/> |
|
44 | 46 | <property name="fileNamePattern" value="module\-info\.java$"/> |
45 | 47 | </module> |
46 | 48 |
|
| 49 | + <!-- https://checkstyle.org/config_filters.html#SuppressionFilter --> |
| 50 | + <module name="SuppressionFilter"> |
| 51 | + <property name="file" value="${org.checkstyle.sun.suppressionfilter.config}" |
| 52 | + default="checkstyle-suppressions.xml" /> |
| 53 | + <property name="optional" value="true"/> |
| 54 | + </module> |
| 55 | + |
47 | 56 | <!-- Checks that a package-info.java file exists for each package. --> |
48 | | - <!-- See http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage --> |
| 57 | + <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage --> |
49 | 58 | <module name="JavadocPackage"/> |
50 | 59 |
|
51 | 60 | <!-- Checks whether files end with a new line. --> |
52 | | - <!-- See http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile --> |
53 | | - <module name="NewlineAtEndOfFile"> |
54 | | - <!-- BorderTech |
55 | | - Choosing "lf" should allow eof to be either "LF" or "CRLF" (both end with "LF"). |
56 | | - This is more permissive and more predicatable than the default "enforce whatever line separator is default on the current platform". |
57 | | - When fetching code via git newlines are usually normalized anyway. |
58 | | - --> |
59 | | - <property name="lineSeparator" value="lf"/> |
60 | | - </module> |
| 61 | + <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile --> |
| 62 | + <module name="NewlineAtEndOfFile"/> |
61 | 63 |
|
62 | 64 | <!-- Checks that property files contain the same keys. --> |
63 | | - <!-- See http://checkstyle.sourceforge.net/config_misc.html#Translation --> |
| 65 | + <!-- See https://checkstyle.org/config_misc.html#Translation --> |
64 | 66 | <module name="Translation"/> |
65 | 67 |
|
66 | 68 | <!-- Checks for Size Violations. --> |
67 | | - <!-- See http://checkstyle.sourceforge.net/config_sizes.html --> |
| 69 | + <!-- See https://checkstyle.org/config_sizes.html --> |
68 | 70 | <module name="FileLength"> |
| 71 | + <!-- BorderTech: Override to warning --> |
| 72 | + <property name="severity" value="warning" /> |
| 73 | + </module> |
| 74 | + <module name="LineLength"> |
| 75 | + <property name="fileExtensions" value="java"/> |
| 76 | + <!-- BorderTech: Override from 80 to 150 --> |
| 77 | + <property name="max" value="150" /> |
| 78 | + <!-- BorderTech: Override to warning --> |
69 | 79 | <property name="severity" value="warning" /> |
70 | 80 | </module> |
71 | 81 |
|
72 | | - <!-- Checks for whitespace --> |
73 | | - <!-- See http://checkstyle.sourceforge.net/config_whitespace.html --> |
74 | | - <!-- |
| 82 | + <!-- See https://checkstyle.org/config_whitespace.html --> |
| 83 | + <!-- BorderTech: This check is removed as it fails if there are tabs |
75 | 84 | <module name="FileTabCharacter"/> |
76 | 85 | --> |
| 86 | + |
| 87 | + <!-- BorderTech: Use tabs for indenting --> |
77 | 88 | <module name="RegexpSingleline"> |
78 | 89 | <property name="format" value="^(\t*( +\t*(?! \*|\S))|( ))"/> |
79 | 90 | <property name="message" value="Indentation should be tabs."/> |
80 | 91 | <property name="maximum" value="10"/> |
81 | 92 | </module> |
82 | 93 |
|
83 | 94 | <!-- Miscellaneous other checks. --> |
84 | | - <!-- See http://checkstyle.sourceforge.net/config_misc.html --> |
| 95 | + <!-- See https://checkstyle.org/config_misc.html --> |
85 | 96 | <module name="RegexpSingleline"> |
86 | 97 | <property name="format" value="\s+$"/> |
87 | | - <property name="maximum" value="10"/> |
| 98 | + <property name="minimum" value="0"/> |
| 99 | + <property name="maximum" value="0"/> |
88 | 100 | <property name="message" value="Line has trailing spaces."/> |
| 101 | + <!-- BorderTech: Override to warning --> |
| 102 | + <property name="severity" value="warning" /> |
89 | 103 | </module> |
90 | 104 |
|
91 | 105 | <!-- Checks for Headers --> |
92 | | - <!-- See http://checkstyle.sourceforge.net/config_header.html --> |
| 106 | + <!-- See https://checkstyle.org/config_header.html --> |
93 | 107 | <!-- <module name="Header"> --> |
94 | 108 | <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> |
95 | 109 | <!-- <property name="fileExtensions" value="java"/> --> |
96 | 110 | <!-- </module> --> |
97 | 111 |
|
98 | 112 | <module name="TreeWalker"> |
99 | | - <!-- BorderTech --> |
| 113 | + |
| 114 | + <!-- BorderTech: Override for how many spaces a tab takes from 8 to 4 --> |
100 | 115 | <property name="tabWidth" value="4"/> |
101 | 116 |
|
102 | | - <!-- BorderTech Make the @SuppressWarnings annotations available to Checkstyle --> |
| 117 | + <!-- BorderTech: Make the @SuppressWarnings annotations available to Checkstyle --> |
| 118 | + <!-- SuppressWarningsFilter and SuppressWarningsHolder have to be used together. --> |
103 | 119 | <module name="SuppressWarningsHolder" /> |
104 | 120 |
|
105 | 121 | <!-- Checks for Javadoc comments. --> |
106 | | - <!-- See http://checkstyle.sourceforge.net/config_javadoc.html --> |
| 122 | + <!-- See https://checkstyle.org/config_javadoc.html --> |
| 123 | + <module name="InvalidJavadocPosition"/> |
107 | 124 | <module name="JavadocMethod"> |
| 125 | + <!-- BorderTech: Javadoc not required for methods with these annotations --> |
108 | 126 | <property name="allowedAnnotations" value="Override,Test,Before,After,BeforeClass,AfterClass"/> |
109 | 127 | </module> |
110 | 128 | <module name="JavadocType"/> |
111 | 129 | <module name="JavadocVariable"> |
| 130 | + <!-- BorderTech: Push scope that is checked from private to protected --> |
112 | 131 | <property name="scope" value="protected"/> |
113 | 132 | </module> |
114 | 133 | <module name="JavadocStyle"/> |
| 134 | + <module name="MissingJavadocMethod"/> |
115 | 135 |
|
116 | 136 | <!-- Checks for Naming Conventions. --> |
117 | | - <!-- See http://checkstyle.sourceforge.net/config_naming.html --> |
118 | | - <module name="ConstantName" /> |
| 137 | + <!-- See https://checkstyle.org/config_naming.html --> |
| 138 | + <module name="ConstantName"/> |
119 | 139 | <module name="LocalFinalVariableName"/> |
120 | 140 | <module name="LocalVariableName"/> |
121 | 141 | <module name="MemberName"/> |
122 | 142 | <module name="MethodName"/> |
123 | 143 | <module name="PackageName"/> |
124 | 144 | <module name="ParameterName"/> |
125 | 145 | <module name="StaticVariableName"/> |
126 | | - <module name="TypeName" /> |
| 146 | + <module name="TypeName"/> |
127 | 147 |
|
128 | 148 | <!-- Checks for imports --> |
129 | | - <!-- See http://checkstyle.sourceforge.net/config_import.html --> |
| 149 | + <!-- See https://checkstyle.org/config_import.html --> |
130 | 150 | <module name="AvoidStarImport"/> |
131 | 151 | <module name="IllegalImport"/> <!-- defaults to sun.* packages --> |
132 | 152 | <module name="RedundantImport"/> |
133 | 153 | <module name="UnusedImports"> |
134 | | - <!-- BorderTech --> |
| 154 | + <!-- BorderTech: Check javadoc as well --> |
135 | 155 | <property name="processJavadoc" value="true" /> |
136 | 156 | </module> |
137 | 157 |
|
138 | 158 | <!-- Checks for Size Violations. --> |
139 | | - <!-- See http://checkstyle.sourceforge.net/config_sizes.html --> |
140 | | - <module name="LineLength"> |
141 | | - <!-- BorderTech --> |
142 | | - <property name="max" value="150" /> |
143 | | - <property name="severity" value="warning" /> |
144 | | - </module> |
| 159 | + <!-- See https://checkstyle.org/config_sizes.html --> |
145 | 160 | <module name="MethodLength"> |
| 161 | + <!-- BorderTech: Override to warning --> |
146 | 162 | <property name="severity" value="warning" /> |
147 | 163 | </module> |
148 | 164 | <module name="ParameterNumber"> |
| 165 | + <!-- BorderTech: Override to warning --> |
149 | 166 | <property name="severity" value="warning" /> |
150 | 167 | </module> |
151 | 168 |
|
152 | 169 | <!-- Checks for whitespace --> |
153 | | - <!-- See http://checkstyle.sourceforge.net/config_whitespace.html --> |
| 170 | + <!-- See https://checkstyle.org/config_whitespace.html --> |
154 | 171 | <module name="EmptyForIteratorPad"/> |
155 | 172 | <module name="GenericWhitespace"/> |
156 | 173 | <module name="MethodParamPad"/> |
157 | 174 | <module name="NoWhitespaceAfter"> |
158 | | - <!-- BorderTech --> |
| 175 | + <!-- BorderTech: Tokens to check --> |
159 | 176 | <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/> |
160 | 177 | </module> |
161 | 178 | <module name="NoWhitespaceBefore"/> |
|
166 | 183 | <module name="WhitespaceAround"/> |
167 | 184 |
|
168 | 185 | <!-- Modifier Checks --> |
169 | | - <!-- See http://checkstyle.sourceforge.net/config_modifiers.html --> |
| 186 | + <!-- See https://checkstyle.org/config_modifiers.html --> |
170 | 187 | <module name="ModifierOrder"/> |
171 | 188 | <module name="RedundantModifier"> |
| 189 | + <!-- BorderTech: Override to warning --> |
172 | 190 | <property name="severity" value="warning" /> |
173 | 191 | </module> |
174 | 192 |
|
175 | 193 | <!-- Checks for blocks. You know, those {}'s --> |
176 | 194 | <!-- See http://checkstyle.sourceforge.net/config_blocks.html --> |
177 | 195 | <module name="AvoidNestedBlocks"> |
178 | | - <!-- BorderTech --> |
| 196 | + <!-- BorderTech: Allow a nested block in a switch --> |
179 | 197 | <property name="allowInSwitchCase" value="true"/> |
180 | 198 | </module> |
181 | 199 | <module name="EmptyBlock"> |
| 200 | + <!-- BorderTech: Override to warning --> |
182 | 201 | <property name="severity" value="warning" /> |
183 | 202 | </module> |
184 | 203 | <module name="LeftCurly"/> |
185 | 204 | <module name="NeedBraces"/> |
186 | 205 | <module name="RightCurly"/> |
187 | 206 |
|
188 | 207 | <!-- Checks for common coding problems --> |
189 | | - <!-- See http://checkstyle.sourceforge.net/config_coding.html --> |
190 | | - <!-- BorderTech |
191 | | - <module name="AvoidInlineConditionals"/> |
192 | | - --> |
| 208 | + <!-- See https://checkstyle.org/config_coding.html --> |
193 | 209 | <module name="EmptyStatement"> |
| 210 | + <!-- BorderTech: Override to warning --> |
194 | 211 | <property name="severity" value="warning" /> |
195 | 212 | </module> |
196 | 213 | <module name="EqualsHashCode"/> |
197 | 214 | <module name="HiddenField"> |
198 | | - <!-- BorderTech --> |
199 | | - <property name="severity" value="ignore" /> |
| 215 | + <!-- BorderTech: Override from false for constructor parameters --> |
| 216 | + <property name="ignoreConstructorParameter" value = "true" /> |
| 217 | + <!-- BorderTech: Override from false for setter parameters --> |
| 218 | + <property name="ignoreSetter" value = "true" /> |
| 219 | + <!-- BorderTech: Override to warning --> |
| 220 | + <property name="severity" value="warning" /> |
200 | 221 | </module> |
201 | 222 | <module name="IllegalInstantiation"/> |
202 | 223 | <module name="InnerAssignment"/> |
203 | 224 | <module name="MagicNumber"> |
204 | | - <property name="severity" value="ignore" /> |
| 225 | + <!-- BorderTech: Override from false for hash code methods --> |
| 226 | + <property name="ignoreHashCodeMethod" value = "true" /> |
| 227 | + <!-- BorderTech: Override from false for annotation methods --> |
| 228 | + <property name="ignoreAnnotation" value = "true" /> |
| 229 | + <!-- BorderTech: Override to warning --> |
| 230 | + <property name="severity" value="warning" /> |
205 | 231 | </module> |
206 | 232 | <module name="MissingSwitchDefault"> |
| 233 | + <!-- BorderTech: Override to warning --> |
207 | 234 | <property name="severity" value="warning" /> |
208 | 235 | </module> |
209 | 236 | <module name="MultipleVariableDeclarations"/> |
210 | 237 | <module name="SimplifyBooleanExpression"/> |
211 | 238 | <module name="SimplifyBooleanReturn"/> |
212 | 239 |
|
213 | 240 | <!-- Checks for class design --> |
214 | | - <!-- See http://checkstyle.sourceforge.net/config_design.html --> |
215 | | - <!-- BorderTech |
| 241 | + <!-- See https://checkstyle.org/config_design.html --> |
| 242 | + <!-- BorderTech: This check is specific for library projects (not applications) |
216 | 243 | <module name="DesignForExtension"/> |
217 | 244 | --> |
218 | 245 | <module name="FinalClass"/> |
|
221 | 248 | <module name="VisibilityModifier"/> |
222 | 249 |
|
223 | 250 | <!-- Miscellaneous other checks. --> |
224 | | - <!-- See http://checkstyle.sourceforge.net/config_misc.html --> |
| 251 | + <!-- See https://checkstyle.org/config_misc.html --> |
225 | 252 | <!-- |
226 | | - <module name="ArrayTypeStyle"/> |
| 253 | + <module name="ArrayTypeStyle"/> |
227 | 254 | --> |
228 | 255 | <module name="FinalParameters"/> |
229 | 256 | <module name="TodoComment"> |
| 257 | + <!-- BorderTech: Override to warning --> |
230 | 258 | <property name="severity" value="warning" /> |
231 | 259 | </module> |
232 | 260 | <module name="UpperEll"/> |
233 | 261 |
|
| 262 | + <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter --> |
| 263 | + <module name="SuppressionXpathFilter"> |
| 264 | + <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" |
| 265 | + default="checkstyle-xpath-suppressions.xml" /> |
| 266 | + <property name="optional" value="true"/> |
| 267 | + </module> |
| 268 | + |
234 | 269 | </module> |
235 | 270 |
|
236 | 271 | </module> |
0 commit comments