update docker mvn config
[dcaegen2/analytics/tca-gen2.git] / dcae-analytics / checkstyle.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4   ~ ================================================================================
5   ~ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6   ~ ================================================================================
7   ~ Licensed under the Apache License, Version 2.0 (the "License");
8   ~ you may not use this file except in compliance with the License.
9   ~ You may obtain a copy of the License at
10   ~
11   ~      http://www.apache.org/licenses/LICENSE-2.0
12   ~
13   ~ Unless required by applicable law or agreed to in writing, software
14   ~ distributed under the License is distributed on an "AS IS" BASIS,
15   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   ~ See the License for the specific language governing permissions and
17   ~ limitations under the License.
18   ~ ============LICENSE_END=========================================================
19   ~
20   -->
21
22 <!DOCTYPE module PUBLIC
23         "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
24         "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
25
26 <!-- This is a checkstyle configuration file. For descriptions of
27 what the following rules do, please see the checkstyle configuration
28 page at http://checkstyle.sourceforge.net/config.html -->
29
30 <module name="Checker">
31
32
33     <!--
34
35      COPYRIGHT HEADER CHECKS
36
37     -->
38
39
40     <module name="FileTabCharacter">
41         <property name="severity" value="error"/>
42         <!-- Checks that there are no tab characters in the file. -->
43     </module>
44
45     <!--
46
47     LENGTH CHECKS FOR FILES
48
49     -->
50
51     <module name="FileLength">
52         <property name="max" value="3000"/>
53         <property name="severity" value="warning"/>
54     </module>
55
56
57     <module name="NewlineAtEndOfFile">
58         <property name="lineSeparator" value="lf"/>
59     </module>
60
61     <module name="RegexpSingleline">
62         <!-- Checks that FIXME is not used in comments.  TODO is preferred. -->
63         <property name="format" value="((//.*)|(\*.*))FIXME"/>
64         <property name="message"
65                   value='TODO is preferred to FIXME.  e.g. "TODO: (ENG-123) -  Refactor when v2 is released."'/>
66     </module>
67
68     <module name="RegexpSingleline">
69         <!-- Checks that TODOs are named with some basic formatting. Checks for the following pattern  TODO: (
70         -->
71         <property name="format" value="((//.*)|(\*.*))TODO[^: (]"/>
72         <property name="message"
73                   value='All TODOs should be named.  e.g. "TODO: (ENG-123) - Refactor when v2 is released."'/>
74     </module>
75
76     <module name="JavadocPackage">
77         <!-- Checks that each Java package has a Javadoc file used for commenting.
78           Only allows a package-info.java, not package.html. -->
79         <property name="severity" value="error"/>
80     </module>
81
82     <!-- All Java AST specific tests live under TreeWalker module. -->
83     <module name="TreeWalker">
84
85         <!-- required for SupressionCommentFilter and SuppressWithNearbyCommentFilter -->
86         <module name="FileContentsHolder"/>
87
88         <!--
89
90         IMPORT CHECKS
91
92         -->
93
94         <module name="AvoidStarImport">
95             <property name="allowClassImports" value="false"/>
96             <property name="severity" value="error"/>
97         </module>
98
99         <module name="RedundantImport">
100             <!-- Checks for redundant import statements. -->
101             <property name="severity" value="error"/>
102         </module>
103
104         <!--
105         <module name="ImportOrder">
106             <property name="severity" value="error"/>
107             <property name="ordered" value="true"/>
108             <property name="option" value="bottom"/>
109             <property name="tokens" value="STATIC_IMPORT, IMPORT"/>
110         </module>
111         -->
112
113         <module name="IllegalImport">
114             <property name="illegalPkgs" value="junit.framework"/>
115         </module>
116
117         <!--
118
119         METHOD LENGTH CHECKS
120
121         -->
122
123         <module name="MethodLength">
124             <property name="tokens" value="METHOD_DEF"/>
125             <property name="max" value="300"/>
126             <property name="countEmpty" value="false"/>
127             <property name="severity" value="warning"/>
128         </module>
129
130         <!--
131
132         JAVADOC CHECKS
133
134         -->
135
136         <!-- Checks for Javadoc comments.                     -->
137         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
138         <module name="JavadocMethod">
139             <property name="scope" value="protected"/>
140             <property name="severity" value="error"/>
141             <property name="allowMissingJavadoc" value="true"/>
142             <property name="allowMissingParamTags" value="true"/>
143             <property name="allowMissingReturnTag" value="true"/>
144             <property name="allowMissingThrowsTags" value="true"/>
145             <property name="allowThrowsTagsForSubclasses" value="true"/>
146             <property name="allowUndeclaredRTE" value="true"/>
147         </module>
148
149         <module name="JavadocType">
150             <property name="scope" value="protected"/>
151             <property name="severity" value="error"/>
152         </module>
153
154         <module name="JavadocStyle">
155             <property name="severity" value="error"/>
156         </module>
157
158         <!--
159
160         NAMING CHECKS
161
162         -->
163
164         <!-- Item 38 - Adhere to generally accepted naming conventions -->
165
166         <module name="PackageName">
167             <!-- Validates identifiers for package names against the
168               supplied expression. -->
169             <!-- Here the default checkstyle rule restricts package name parts to
170               seven characters, this is not in line with common practice at Google.
171             -->
172             <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
173             <property name="severity" value="error"/>
174         </module>
175
176         <module name="TypeNameCheck">
177             <!-- Validates static, final fields against the
178             expression "^[A-Z][a-zA-Z0-9]*$". -->
179             <metadata name="altname" value="TypeName"/>
180             <property name="severity" value="error"/>
181         </module>
182
183         <module name="ConstantNameCheck">
184             <!-- Validates non-private, static, final fields against the supplied
185             public/package final fields "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". -->
186             <metadata name="altname" value="ConstantName"/>
187             <property name="applyToPublic" value="true"/>
188             <property name="applyToProtected" value="true"/>
189             <property name="applyToPackage" value="true"/>
190             <property name="applyToPrivate" value="false"/>
191             <property name="format" value="^log(ger)?|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|FLAG_.*)$"/>
192             <message key="name.invalidPattern"
193                      value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/>
194             <property name="severity" value="error"/>
195         </module>
196
197         <module name="StaticVariableNameCheck">
198             <!-- Validates static, non-final fields against the supplied
199             expression "^[a-z][a-zA-Z0-9]*_?$". -->
200             <metadata name="altname" value="StaticVariableName"/>
201             <property name="applyToPublic" value="true"/>
202             <property name="applyToProtected" value="true"/>
203             <property name="applyToPackage" value="true"/>
204             <property name="applyToPrivate" value="true"/>
205             <property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/>
206             <property name="severity" value="error"/>
207         </module>
208
209         <module name="MemberNameCheck">
210             <!-- Validates non-static members against the supplied expression. -->
211             <metadata name="altname" value="MemberName"/>
212             <property name="applyToPublic" value="true"/>
213             <property name="applyToProtected" value="true"/>
214             <property name="applyToPackage" value="true"/>
215             <property name="applyToPrivate" value="true"/>
216             <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
217             <property name="severity" value="error"/>
218         </module>
219
220         <module name="MethodNameCheck">
221             <!-- Validates identifiers for method names. -->
222             <metadata name="altname" value="MethodName"/>
223             <property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$"/>
224             <property name="severity" value="error"/>
225         </module>
226
227         <module name="ParameterName">
228             <!-- Validates identifiers for method parameters against the
229               expression "^[a-z][a-zA-Z0-9]*$". -->
230             <property name="severity" value="error"/>
231         </module>
232
233         <module name="LocalFinalVariableName">
234             <!-- Validates identifiers for local final variables against the
235               expression "^[a-z][a-zA-Z0-9]*$". -->
236             <property name="severity" value="error"/>
237         </module>
238
239         <module name="LocalVariableName">
240             <!-- Validates identifiers for local variables against the
241               expression "^[a-z][a-zA-Z0-9]*$". -->
242             <property name="severity" value="error"/>
243         </module>
244
245
246         <!--
247
248         LENGTH and CODING CHECKS
249
250         -->
251
252         <module name="LineLength">
253             <!-- Checks if a line is too long. -->
254             <property name="max" value="120" default="120"/>
255             <property name="severity" value="error"/>
256
257             <!--
258               The default ignore pattern exempts the following elements:
259                 - import statements
260                 - long URLs inside comments
261             -->
262
263             <property name="ignorePattern"
264                       value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
265                       default="^(package .*;\s*)|(import .*;\s*)|( *\* *https?://.*)$"/>
266         </module>
267
268         <module name="LeftCurly">
269             <!-- Checks for placement of the left curly brace ('{'). -->
270             <property name="severity" value="error"/>
271         </module>
272
273         <module name="RightCurly">
274             <!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on
275             the same line. e.g., the following example is fine:
276             <pre>
277               if {
278                 ...
279               } else
280             </pre>
281             -->
282             <!-- This next example is not fine:
283             <pre>
284               if {
285                 ...
286               }
287               else
288             </pre>
289             -->
290             <property name="option" value="same"/>
291             <property name="severity" value="error"/>
292         </module>
293
294         <!-- Checks for braces around if and else blocks -->
295         <module name="NeedBraces">
296             <property name="severity" value="error"/>
297             <property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
298         </module>
299
300         <module name="UpperEll">
301             <!-- Checks that long constants are defined with an upper ell.-->
302             <property name="severity" value="error"/>
303         </module>
304
305         <module name="FallThrough">
306             <!-- Warn about falling through to the next case statement.  Similar to
307             javac -Xlint:fallthrough, but the check is suppressed if a single-line comment
308             on the last non-blank line preceding the fallen-into case contains 'fall through' (or
309             some other variants which we don't publicized to promote consistency).
310             -->
311             <property name="reliefPattern"
312                       value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/>
313             <property name="severity" value="error"/>
314         </module>
315
316
317         <!--
318
319         MODIFIERS CHECKS
320
321         -->
322
323         <module name="ModifierOrder">
324             <!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and
325                  8.4.3.  The prescribed order is:
326                  public, protected, private, abstract, static, final, transient, volatile,
327                  synchronized, native, strictfp
328               -->
329         </module>
330
331         <module name="RedundantModifier">
332             <!-- Checks for redundant modifiers in:
333                  - interface and annotation definitions,
334                  - the final modifier on methods of final classes, and
335                  - inner interface declarations that are declared as static.
336               -->
337         </module>
338
339
340         <!--
341
342         WHITESPACE CHECKS
343
344         -->
345         <module name="GenericWhitespace"/>
346
347         <module name="WhitespaceAround">
348             <!-- Checks that various tokens are surrounded by whitespace.
349                  This includes most binary operators and keywords followed
350                  by regular or curly braces.
351             -->
352             <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
353         BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
354         EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
355         LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
356         LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
357         MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
358         SL, SLIST, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
359             <property name="allowEmptyConstructors" value="true"/>
360             <property name="allowEmptyMethods" value="true"/>
361             <property name="severity" value="error"/>
362         </module>
363
364         <module name="WhitespaceAfter">
365             <!-- Checks that commas, semicolons and typecasts are followed by
366                  whitespace.
367             -->
368             <property name="tokens" value="COMMA, SEMI, TYPECAST"/>
369             <property name="severity" value="error"/>
370         </module>
371
372         <module name="NoWhitespaceAfter">
373             <!-- Checks that there is no whitespace after various unary operators.
374                  Linebreaks are allowed.
375             -->
376             <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS,
377         UNARY_PLUS"/>
378             <property name="allowLineBreaks" value="true"/>
379             <property name="severity" value="error"/>
380         </module>
381
382         <module name="NoWhitespaceBefore">
383             <!-- Checks that there is no whitespace before various unary operators.
384                  Linebreaks are allowed.
385             -->
386             <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
387             <property name="allowLineBreaks" value="true"/>
388             <property name="severity" value="error"/>
389         </module>
390
391         <module name="ParenPad">
392             <!-- Checks that there is no whitespace before close parens or after
393                  open parens.
394             -->
395             <property name="severity" value="error"/>
396         </module>
397
398     </module>
399
400     <!--
401       Optional suppression filter. It is optional because when running with Maven, it should be the
402        checkstyle plugin who provides it. It is only used when this file is used in IntelliJ.
403       -->
404     <module name="SuppressionFilter">
405         <property name="file" value="suppressions.xml"/>
406         <property name="optional" value="true"/>
407     </module>
408
409     <module name="SuppressionCommentFilter">
410         <property name="offCommentFormat" value="CHECKSTYLE OFF: (.+)"/>
411         <property name="onCommentFormat" value="CHECKSTYLE ON"/>
412         <property name="checkFormat" value="Javadoc.*"/>
413         <property name="messageFormat" value="$1"/>
414     </module>
415
416 </module>