|
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 | 21 | Finally, it is worth reading the documentation. |
|
28 | 28 | https://checkstyle.org/5.x/config.html#Checker |
29 | 29 | <property name="basedir" value="${basedir}"/> |
30 | 30 | --> |
| 31 | + <property name="severity" value="error"/> |
31 | 32 |
|
32 | | - |
33 | | - <!-- BorderTech Filter out Checkstyle warnings that have been suppressed with the @SuppressWarnings annotation --> |
| 33 | + <!-- BorderTech: Filter out Checkstyle warnings that have been suppressed with the @SuppressWarnings annotation --> |
34 | 34 | <module name="SuppressWarningsFilter" /> |
35 | 35 |
|
36 | | - <!-- BorderTech |
| 36 | + <!-- BorderTech: only check java files |
37 | 37 | <property name="fileExtensions" value="java, properties, xml"/> |
38 | 38 | --> |
39 | 39 | <property name="fileExtensions" value="java"/> |
|
44 | 44 | <property name="fileNamePattern" value="module\-info\.java$"/> |
45 | 45 | </module> |
46 | 46 |
|
| 47 | + <!-- https://checkstyle.org/config_filters.html#SuppressionFilter --> |
| 48 | + <module name="SuppressionFilter"> |
| 49 | + <property name="file" value="${org.checkstyle.sun.suppressionfilter.config}" |
| 50 | + default="checkstyle-suppressions.xml" /> |
| 51 | + <property name="optional" value="true"/> |
| 52 | + </module> |
| 53 | + |
47 | 54 | <!-- Checks that a package-info.java file exists for each package. --> |
48 | | - <!-- See http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage --> |
| 55 | + <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage --> |
49 | 56 | <module name="JavadocPackage"/> |
50 | 57 |
|
51 | 58 | <!-- 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> |
| 59 | + <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile --> |
| 60 | + <module name="NewlineAtEndOfFile"/> |
61 | 61 |
|
62 | 62 | <!-- Checks that property files contain the same keys. --> |
63 | | - <!-- See http://checkstyle.sourceforge.net/config_misc.html#Translation --> |
| 63 | + <!-- See https://checkstyle.org/config_misc.html#Translation --> |
64 | 64 | <module name="Translation"/> |
65 | 65 |
|
66 | 66 | <!-- Checks for Size Violations. --> |
67 | | - <!-- See http://checkstyle.sourceforge.net/config_sizes.html --> |
| 67 | + <!-- See https://checkstyle.org/config_sizes.html --> |
68 | 68 | <module name="FileLength"> |
| 69 | + <!-- Bordertech: override to warning --> |
| 70 | + <property name="severity" value="warning" /> |
| 71 | + </module> |
| 72 | + <module name="LineLength"> |
| 73 | + <property name="fileExtensions" value="java"/> |
| 74 | + <!-- BorderTech: override from 80 to 150 --> |
| 75 | + <property name="max" value="150" /> |
| 76 | + <!-- Bordertech: override to warning --> |
69 | 77 | <property name="severity" value="warning" /> |
70 | 78 | </module> |
71 | 79 |
|
72 | | - <!-- Checks for whitespace --> |
73 | | - <!-- See http://checkstyle.sourceforge.net/config_whitespace.html --> |
74 | | - <!-- |
| 80 | + <!-- See https://checkstyle.org/config_whitespace.html --> |
| 81 | + <!-- Bordetech: This check is removed as it fails if there are tabs |
75 | 82 | <module name="FileTabCharacter"/> |
76 | 83 | --> |
| 84 | + <!-- Bordertech: Use tabs for indenting --> |
77 | 85 | <module name="RegexpSingleline"> |
78 | 86 | <property name="format" value="^(\t*( +\t*(?! \*|\S))|( ))"/> |
79 | 87 | <property name="message" value="Indentation should be tabs."/> |
80 | 88 | <property name="maximum" value="10"/> |
81 | 89 | </module> |
82 | 90 |
|
83 | 91 | <!-- Miscellaneous other checks. --> |
84 | | - <!-- See http://checkstyle.sourceforge.net/config_misc.html --> |
| 92 | + <!-- See https://checkstyle.org/config_misc.html --> |
85 | 93 | <module name="RegexpSingleline"> |
86 | 94 | <property name="format" value="\s+$"/> |
87 | | - <property name="maximum" value="10"/> |
| 95 | + <property name="minimum" value="0"/> |
| 96 | + <property name="maximum" value="0"/> |
88 | 97 | <property name="message" value="Line has trailing spaces."/> |
| 98 | + <!-- Bordertech: override to warning --> |
| 99 | + <property name="severity" value="warning" /> |
89 | 100 | </module> |
90 | 101 |
|
91 | 102 | <!-- Checks for Headers --> |
92 | | - <!-- See http://checkstyle.sourceforge.net/config_header.html --> |
| 103 | + <!-- See https://checkstyle.org/config_header.html --> |
93 | 104 | <!-- <module name="Header"> --> |
94 | 105 | <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> |
95 | 106 | <!-- <property name="fileExtensions" value="java"/> --> |
96 | 107 | <!-- </module> --> |
97 | 108 |
|
98 | 109 | <module name="TreeWalker"> |
99 | | - <!-- BorderTech --> |
| 110 | + |
| 111 | + <!-- BorderTech: Override for how many spaces a tab takes from 8 to 4 --> |
100 | 112 | <property name="tabWidth" value="4"/> |
101 | 113 |
|
102 | | - <!-- BorderTech Make the @SuppressWarnings annotations available to Checkstyle --> |
| 114 | + <!-- BorderTech: Make the @SuppressWarnings annotations available to Checkstyle --> |
103 | 115 | <module name="SuppressWarningsHolder" /> |
104 | 116 |
|
105 | 117 | <!-- Checks for Javadoc comments. --> |
106 | | - <!-- See http://checkstyle.sourceforge.net/config_javadoc.html --> |
| 118 | + <!-- See https://checkstyle.org/config_javadoc.html --> |
| 119 | + <module name="InvalidJavadocPosition"/> |
107 | 120 | <module name="JavadocMethod"> |
| 121 | + <!-- Bordertech: Javadoc not required for methods with these annotations --> |
108 | 122 | <property name="allowedAnnotations" value="Override,Test,Before,After,BeforeClass,AfterClass"/> |
109 | 123 | </module> |
110 | 124 | <module name="JavadocType"/> |
111 | 125 | <module name="JavadocVariable"> |
| 126 | + <!-- Bordertech: Push scope that is checked from private to protected --> |
112 | 127 | <property name="scope" value="protected"/> |
113 | 128 | </module> |
114 | 129 | <module name="JavadocStyle"/> |
| 130 | + <module name="MissingJavadocMethod"/> |
115 | 131 |
|
116 | 132 | <!-- Checks for Naming Conventions. --> |
117 | | - <!-- See http://checkstyle.sourceforge.net/config_naming.html --> |
118 | | - <module name="ConstantName" /> |
| 133 | + <!-- See https://checkstyle.org/config_naming.html --> |
| 134 | + <module name="ConstantName"/> |
119 | 135 | <module name="LocalFinalVariableName"/> |
120 | 136 | <module name="LocalVariableName"/> |
121 | 137 | <module name="MemberName"/> |
122 | 138 | <module name="MethodName"/> |
123 | 139 | <module name="PackageName"/> |
124 | 140 | <module name="ParameterName"/> |
125 | 141 | <module name="StaticVariableName"/> |
126 | | - <module name="TypeName" /> |
| 142 | + <module name="TypeName"/> |
127 | 143 |
|
128 | 144 | <!-- Checks for imports --> |
129 | | - <!-- See http://checkstyle.sourceforge.net/config_import.html --> |
| 145 | + <!-- See https://checkstyle.org/config_import.html --> |
130 | 146 | <module name="AvoidStarImport"/> |
131 | 147 | <module name="IllegalImport"/> <!-- defaults to sun.* packages --> |
132 | 148 | <module name="RedundantImport"/> |
133 | 149 | <module name="UnusedImports"> |
134 | | - <!-- BorderTech --> |
| 150 | + <!-- BorderTech: Check javadoc as well --> |
135 | 151 | <property name="processJavadoc" value="true" /> |
136 | 152 | </module> |
137 | 153 |
|
138 | 154 | <!-- 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> |
| 155 | + <!-- See https://checkstyle.org/config_sizes.html --> |
145 | 156 | <module name="MethodLength"> |
| 157 | + <!-- Bordertech: override to warning --> |
146 | 158 | <property name="severity" value="warning" /> |
147 | 159 | </module> |
148 | 160 | <module name="ParameterNumber"> |
| 161 | + <!-- Bordertech: override to warning --> |
149 | 162 | <property name="severity" value="warning" /> |
150 | 163 | </module> |
151 | 164 |
|
152 | 165 | <!-- Checks for whitespace --> |
153 | | - <!-- See http://checkstyle.sourceforge.net/config_whitespace.html --> |
| 166 | + <!-- See https://checkstyle.org/config_whitespace.html --> |
154 | 167 | <module name="EmptyForIteratorPad"/> |
155 | 168 | <module name="GenericWhitespace"/> |
156 | 169 | <module name="MethodParamPad"/> |
157 | 170 | <module name="NoWhitespaceAfter"> |
158 | | - <!-- BorderTech --> |
| 171 | + <!-- BorderTech: Tokens to check --> |
159 | 172 | <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/> |
160 | 173 | </module> |
161 | 174 | <module name="NoWhitespaceBefore"/> |
|
166 | 179 | <module name="WhitespaceAround"/> |
167 | 180 |
|
168 | 181 | <!-- Modifier Checks --> |
169 | | - <!-- See http://checkstyle.sourceforge.net/config_modifiers.html --> |
| 182 | + <!-- See https://checkstyle.org/config_modifiers.html --> |
170 | 183 | <module name="ModifierOrder"/> |
171 | 184 | <module name="RedundantModifier"> |
| 185 | + <!-- Bordertech: override to warning --> |
172 | 186 | <property name="severity" value="warning" /> |
173 | 187 | </module> |
174 | 188 |
|
175 | 189 | <!-- Checks for blocks. You know, those {}'s --> |
176 | 190 | <!-- See http://checkstyle.sourceforge.net/config_blocks.html --> |
177 | 191 | <module name="AvoidNestedBlocks"> |
178 | | - <!-- BorderTech --> |
| 192 | + <!-- BorderTech: Allow a nested block in a switch --> |
179 | 193 | <property name="allowInSwitchCase" value="true"/> |
180 | 194 | </module> |
181 | 195 | <module name="EmptyBlock"> |
| 196 | + <!-- Bordertech: override to warning --> |
182 | 197 | <property name="severity" value="warning" /> |
183 | 198 | </module> |
184 | 199 | <module name="LeftCurly"/> |
185 | 200 | <module name="NeedBraces"/> |
186 | 201 | <module name="RightCurly"/> |
187 | 202 |
|
188 | 203 | <!-- Checks for common coding problems --> |
189 | | - <!-- See http://checkstyle.sourceforge.net/config_coding.html --> |
190 | | - <!-- BorderTech |
191 | | - <module name="AvoidInlineConditionals"/> |
192 | | - --> |
| 204 | + <!-- See https://checkstyle.org/config_coding.html --> |
193 | 205 | <module name="EmptyStatement"> |
| 206 | + <!-- Bordertech: override to warning --> |
194 | 207 | <property name="severity" value="warning" /> |
195 | 208 | </module> |
196 | 209 | <module name="EqualsHashCode"/> |
197 | 210 | <module name="HiddenField"> |
198 | | - <!-- BorderTech --> |
| 211 | + <!-- Bordertech: override to ignore --> |
199 | 212 | <property name="severity" value="ignore" /> |
200 | 213 | </module> |
201 | 214 | <module name="IllegalInstantiation"/> |
202 | 215 | <module name="InnerAssignment"/> |
203 | 216 | <module name="MagicNumber"> |
| 217 | + <!-- Bordertech: override to ignore --> |
204 | 218 | <property name="severity" value="ignore" /> |
205 | 219 | </module> |
206 | 220 | <module name="MissingSwitchDefault"> |
| 221 | + <!-- Bordertech: override to warning --> |
207 | 222 | <property name="severity" value="warning" /> |
208 | 223 | </module> |
209 | 224 | <module name="MultipleVariableDeclarations"/> |
210 | 225 | <module name="SimplifyBooleanExpression"/> |
211 | 226 | <module name="SimplifyBooleanReturn"/> |
212 | 227 |
|
213 | 228 | <!-- Checks for class design --> |
214 | | - <!-- See http://checkstyle.sourceforge.net/config_design.html --> |
215 | | - <!-- BorderTech |
| 229 | + <!-- See https://checkstyle.org/config_design.html --> |
| 230 | + <!-- BorderTech: This check is specific for library projects (not applications) |
216 | 231 | <module name="DesignForExtension"/> |
217 | 232 | --> |
218 | 233 | <module name="FinalClass"/> |
|
221 | 236 | <module name="VisibilityModifier"/> |
222 | 237 |
|
223 | 238 | <!-- Miscellaneous other checks. --> |
224 | | - <!-- See http://checkstyle.sourceforge.net/config_misc.html --> |
| 239 | + <!-- See https://checkstyle.org/config_misc.html --> |
225 | 240 | <!-- |
226 | 241 | <module name="ArrayTypeStyle"/> |
227 | 242 | --> |
228 | 243 | <module name="FinalParameters"/> |
229 | 244 | <module name="TodoComment"> |
| 245 | + <!-- Bordertech: override to warning --> |
230 | 246 | <property name="severity" value="warning" /> |
231 | 247 | </module> |
232 | 248 | <module name="UpperEll"/> |
233 | 249 |
|
| 250 | + <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter --> |
| 251 | + <module name="SuppressionXpathFilter"> |
| 252 | + <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" |
| 253 | + default="checkstyle-xpath-suppressions.xml" /> |
| 254 | + <property name="optional" value="true"/> |
| 255 | + </module> |
| 256 | + |
234 | 257 | </module> |
235 | 258 |
|
236 | 259 | </module> |
0 commit comments