|
2 | 2 | <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> |
3 | 3 |
|
4 | 4 | <!-- |
5 | | - Checkstyle-Configuration: CommandHelper |
6 | | - Description: A checkstyle configuration for CommandHelper. |
7 | | - Author: P.J.S. Kools |
| 5 | + Checkstyle-Configuration: CommandHelper |
| 6 | + Description: A checkstyle configuration for CommandHelper. |
| 7 | + Author: P.J.S. Kools |
8 | 8 | --> |
9 | 9 | <module name="Checker"> |
10 | | - <property name="severity" value="error"/> |
11 | | - |
12 | | - <!-- Supression filter to disable specified modules/checks for specified files --> |
13 | | - <module name="SuppressionFilter"> |
14 | | - <property name="file" value="checkstyle_suppressions.xml"/> |
15 | | - <property name="optional" value="false"/> |
16 | | - </module> |
17 | | - |
18 | | - <module name="TreeWalker"> |
19 | | - |
20 | | - <!-- Line length <= 120 characters --> |
21 | | - <module name="LineLength"> |
22 | | - <property name="severity" value="ignore"/> <!-- TODO: Change to "error" once the >7000 violations have been resolved --> |
23 | | - <property name="max" value="120"/> |
24 | | - </module> |
25 | | - |
26 | | - <!-- Indent must use tab characters --> |
27 | | - <module name="RegexpSinglelineJava"> |
28 | | - <property name="format" value="^\t* ([^\*]|$)"/> <!-- Javadoc and multiline comments have a single leading whitespace, so allow " *" --> |
29 | | - <property name="message" value="Indent must use tab characters"/> |
30 | | - <property name="ignoreComments" value="false"/> |
31 | | - </module> |
32 | | - |
33 | | - <!-- Disallow package.* imports --> |
34 | | - <module name="AvoidStarImport"/> |
35 | | - |
36 | | - <!-- Disallow whitespaces after '(' and before ')' --> |
37 | | - <module name="ParenPad"/> |
38 | | - |
39 | | - </module> |
40 | | - |
41 | | - <!-- Disallow trailing whitespaces/tabs --> |
42 | | - <module name="RegexpSingleline"> |
43 | | - <property name="severity" value="error"/> |
44 | | - <property name="format" value="(?<! \*)\s+$"/> <!-- Empty javadoc and multiline comment lines have a single trailing whitespace, so allow " * " --> |
45 | | - <property name="message" value="Line has trailing whitespaces/tabs."/> |
46 | | - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> |
47 | | - </module> |
| 10 | + <property name="severity" value="error"/> |
| 11 | + |
| 12 | + <!-- Supression filter to disable specified modules/checks for specified files --> |
| 13 | + <module name="SuppressionFilter"> |
| 14 | + <property name="file" value="checkstyle_suppressions.xml"/> |
| 15 | + <property name="optional" value="false"/> |
| 16 | + </module> |
| 17 | + |
| 18 | + <!-- Allow "@SuppressWarnings(checkstyle:<CHECK>)" checkstyle violation suppression --> |
| 19 | + <module name="SuppressWarningsFilter"/> |
| 20 | + |
| 21 | + <module name="TreeWalker"> |
| 22 | + |
| 23 | + <!-- Enable usage of "@SuppressWarnings(checkstyle:<CHECK>)" to suppress checkstyle violations --> |
| 24 | + <module name="SuppressWarningsHolder"/> |
| 25 | + |
| 26 | + <!-- Set tabWidth property for checks such as line length --> |
| 27 | + <property name="tabWidth" value="4"/> |
| 28 | + |
| 29 | + <!-- Line length <= 120 characters --> |
| 30 | + <module name="LineLength"> |
| 31 | + <property name="severity" value="ignore"/> <!-- TODO: Change to "error" once the >7000 violations have been resolved --> |
| 32 | + <property name="max" value="120"/> |
| 33 | + </module> |
| 34 | + |
| 35 | + <!-- Indent must use tab characters --> |
| 36 | + <module name="RegexpSinglelineJava"> |
| 37 | + <property name="format" value="^\t* ([^\*]|$)"/> <!-- Javadoc and multiline comments have a single leading whitespace, so allow " *" --> |
| 38 | + <property name="message" value="Indent must use tab characters"/> |
| 39 | + <property name="ignoreComments" value="false"/> |
| 40 | + </module> |
| 41 | + |
| 42 | + <!-- Disallow package.* imports --> |
| 43 | + <module name="AvoidStarImport"/> |
| 44 | + |
| 45 | + <!-- Ensure static final field name format. Default format: "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$" --> |
| 46 | + <module name="ConstantName"/> |
| 47 | + |
| 48 | + <!-- Default case in switch/case statement has to come last --> |
| 49 | + <module name="DefaultComesLast"/> |
| 50 | + |
| 51 | + <!-- Disallow "public boolean equals(Foo obj)" since this does not always override "public boolean equals(Object obj)" --> |
| 52 | + <module name="CovariantEquals"/> |
| 53 | + |
| 54 | + <!-- Disallow empty statements (just a single ";") --> |
| 55 | + <module name="EmptyStatement"/> |
| 56 | + |
| 57 | + <!-- Ensure that "break" or "return" is used in non-empty switch/case cases --> |
| 58 | + <module name="FallThrough"/> |
| 59 | + |
| 60 | + <!-- Ensure that classes without public constructor are final --> |
| 61 | + <module name="FinalClass"/> |
| 62 | + |
| 63 | + <!-- Ensure proper whitespace usage around "<" and ">" for generic types --> |
| 64 | + <module name="GenericWhitespace"/> |
| 65 | + |
| 66 | + <!-- Disallow native literals --> |
| 67 | + <module name="IllegalToken"> |
| 68 | + <property name="tokens" value="LITERAL_NATIVE"/> |
| 69 | + </module> |
| 70 | + |
| 71 | + <!-- Ensure usage of "{" at the end of a line (and not on a newline) --> |
| 72 | + <module name="LeftCurly"/> |
| 73 | + |
| 74 | + <!-- Ensure local final variable name format. Default format: "^[a-z][a-zA-Z0-9]*$" --> |
| 75 | + <module name="LocalFinalVariableName"/> |
| 76 | + |
| 77 | + <!-- Ensure local non-final variable name format, except single-character variables in for loops. Default format: "^[a-z][a-zA-Z0-9]*$". --> |
| 78 | + <module name="LocalVariableName"> |
| 79 | + <property name="allowOneCharVarInForLoop" value="true"/> |
| 80 | + </module> |
| 81 | + |
| 82 | + <!-- Ensure non-static instance name format. Default format: "^[a-z][a-zA-Z0-9]*$" --> |
| 83 | + <module name="MemberName"/> |
| 84 | + |
| 85 | + <!-- Ensure method name format and disallow methods to be named the same as the class (and therefore constructor). Default format: "^[a-z][a-zA-Z0-9]*$" --> |
| 86 | + <module name="MethodName"> |
| 87 | + <!-- TODO: Disable rule or fix violations with the chance to break extensions. There are 479 violations as of 14-06-2018 dd-mm-yyyy --> |
| 88 | + <property name="severity" value="ignore"/> |
| 89 | + </module> |
| 90 | + |
| 91 | + <!-- Check method parameter padding --> |
| 92 | + <module name="MethodParamPad"/> |
| 93 | + |
| 94 | + <!-- Check method type name format. Default format: "^[A-Z]$" --> |
| 95 | + <module name="MethodTypeParameterName"/> |
| 96 | + |
| 97 | + <!-- Ensure that both the @Deprecated and the @deprecated javadoc tag are present when one is present --> |
| 98 | + <module name="MissingDeprecated"/> |
| 99 | + |
| 100 | + <!-- Ensure that the @Override tag is present when the {@inheritDoc} javadoc tag is present --> |
| 101 | + <module name="MissingOverride"/> |
| 102 | + |
| 103 | + <!-- Ensure modifier order is 'first > last': public > protected > private > abstract > default > static > final > transient > volatile > synchronized > native > strictfp --> |
| 104 | + <module name="ModifierOrder"/> |
| 105 | + |
| 106 | + <!-- Ensure that each variable has its own statement on its own line (disallows "i = j = k = 1;") --> |
| 107 | + <module name="MultipleVariableDeclarations"/> |
| 108 | + |
| 109 | + <!-- Ensure that do/else/for/if/while have their brace block ("{...}") --> |
| 110 | + <module name="NeedBraces"/> |
| 111 | + |
| 112 | + <!-- Ensure that there is no whitespace after the given tokens --> |
| 113 | + <module name="NoWhitespaceAfter"> |
| 114 | + <property name="tokens" value="INC,DEC,UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT"/> |
| 115 | + </module> |
| 116 | + |
| 117 | + <!-- Ensure that there is no whitespace before the given tokens --> |
| 118 | + <module name="NoWhitespaceBefore"> |
| 119 | + <property name="tokens" value="COMMA,SEMI,POST_INC,POST_DEC,GENERIC_END,ELLIPSIS,METHOD_REF"/> |
| 120 | + </module> |
| 121 | + |
| 122 | + <!-- Ensure that there is a whitespace after the given tokens --> |
| 123 | + <module name="WhitespaceAfter"> |
| 124 | + <property name="tokens" value="COMMA,SEMI,TYPECAST,LITERAL_ELSE,LITERAL_DO"/> |
| 125 | + </module> |
| 126 | + |
| 127 | + <!-- Ensure that there are whitespace around the given tokens --> |
| 128 | + <module name="WhitespaceAround"> |
| 129 | + <property name="allowEmptyConstructors" value="true"/> |
| 130 | + <property name="allowEmptyMethods" value="true"/> |
| 131 | + <property name="allowEmptyTypes" value="true"/> |
| 132 | + <property name="allowEmptyLoops" value="true"/> |
| 133 | + <property name="allowEmptyLambdas" value="true"/> |
| 134 | + <property name="allowEmptyCatches" value="true"/> |
| 135 | + <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, |
| 136 | + BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAMBDA, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, |
| 137 | + LITERAL_ELSE, LITERAL_FINALLY, LITERAL_RETURN, |
| 138 | + LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, |
| 139 | + RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/> |
| 140 | + </module> |
| 141 | + |
| 142 | + <!-- Ensure that line-wrapped operators appear after the newline --> |
| 143 | + <module name="OperatorWrap"> |
| 144 | + <property name="tokens" value="QUESTION, COLON, EQUAL, NOT_EQUAL, DIV, PLUS, MINUS, STAR, MOD, SR, BSR, GE, |
| 145 | + GT, SL, LE, LT, BXOR, BOR, LOR, BAND, LAND, LITERAL_INSTANCEOF, TYPE_EXTENSION_AND"/> |
| 146 | + </module> |
| 147 | + |
| 148 | + <!-- Ensure that overloaded methods are grouped together (have no other method in between) --> |
| 149 | + <module name="OverloadMethodsDeclarationOrder"/> |
| 150 | + |
| 151 | + <!-- Ensure package name format. Default format: "^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$" --> |
| 152 | + <module name="PackageName"/> |
| 153 | + |
| 154 | + <!-- Ensure method and catch parameter name format. Default format: "^[a-z][a-zA-Z0-9]*$" --> |
| 155 | + <module name="ParameterName"/> |
| 156 | + |
| 157 | + <!-- Disallow whitespaces after '(' and before ')' --> |
| 158 | + <module name="ParenPad"/> |
| 159 | + |
| 160 | + <!-- Disallow redundant (double or default-available class) imports --> |
| 161 | + <module name="RedundantImport"/> |
| 162 | + |
| 163 | + <!-- Ensure usage of "}" for the given tokens --> |
| 164 | + <module name="RightCurly"> |
| 165 | + <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE"/> |
| 166 | + </module> |
| 167 | + |
| 168 | + <!-- Ensure that when lines are wrapped at a dot, this dot is on the new line. --> |
| 169 | + <module name="SeparatorWrap"> |
| 170 | + <property name="option" value="nl"/> |
| 171 | + <property name="tokens" value="DOT"/> |
| 172 | + </module> |
| 173 | + |
| 174 | + <!-- Ensure that when lines are wrapped at a comma, this comma is at the end of the line. --> |
| 175 | + <module name="SeparatorWrap"> |
| 176 | + <property name="option" value="eol"/> |
| 177 | + <property name="tokens" value="COMMA"/> |
| 178 | + </module> |
| 179 | + |
| 180 | + <!-- Ensure non-static, non-final field name format. Default format: "^[a-z][a-zA-Z0-9]*$" --> |
| 181 | + <module name="StaticVariableName"/> |
| 182 | + |
| 183 | + <!-- Disallow the "==" operator for string literals --> |
| 184 | + <module name="StringLiteralEquality"/> |
| 185 | + |
| 186 | + <!-- Disallow whitespaces between type cast parenthesis (No whitespace at X: "(XObjectX) obj") --> |
| 187 | + <module name="TypecastParenPad"/> |
| 188 | + |
| 189 | + <!-- Ensure class, interface, enum and annotation name format. Default format: "^[A-Z][a-zA-Z0-9]*$" --> |
| 190 | + <module name="TypeName"/> |
| 191 | + |
| 192 | + <!-- Disallow unused imports --> |
| 193 | + <module name="UnusedImports"/> |
| 194 | + |
| 195 | + <!-- Ensure that long constants are defined using an 'L', rather than an 'l' --> |
| 196 | + <module name="UpperEll"/> |
| 197 | + |
| 198 | + </module> |
| 199 | + |
| 200 | + <!-- Disallow trailing whitespaces/tabs --> |
| 201 | + <module name="RegexpSingleline"> |
| 202 | + <property name="severity" value="error"/> |
| 203 | + <property name="format" value="(?<! \*)\s+$"/> <!-- Empty javadoc and multiline comment lines have a single trailing whitespace, so allow " * " --> |
| 204 | + <property name="message" value="Line has trailing whitespaces/tabs."/> |
| 205 | + </module> |
| 206 | + |
| 207 | + <!-- Disallow whitespaces between if/for/while and '(' --> |
| 208 | + <module name="RegexpSingleline"> |
| 209 | + <property name="severity" value="error"/> |
| 210 | + <property name="format" value="(^|[^\w\._])(if|for|while)[\s]+\("/> |
| 211 | + <property name="message" value="Whitespace between if/for/while and '(' is not allowed."/> |
| 212 | + </module> |
| 213 | + |
| 214 | + <!-- Ensure whitespace between try and '{' --> |
| 215 | + <module name="RegexpSingleline"> |
| 216 | + <property name="severity" value="error"/> |
| 217 | + <property name="format" value="(^|[^\w\._])try\{"/> |
| 218 | + <property name="message" value="'try' is not followed by whitespace."/> |
| 219 | + </module> |
| 220 | + |
| 221 | + <!-- Disallow whitespaces between try and '(' (try-with-resources) --> |
| 222 | + <module name="RegexpSingleline"> |
| 223 | + <property name="severity" value="error"/> |
| 224 | + <property name="format" value="(^|[^\w\._])try[\s]+\("/> |
| 225 | + <property name="message" value="'try' with resources is followed by whitespace."/> |
| 226 | + </module> |
| 227 | + |
| 228 | + <!-- Ensure that every file ends with a newline --> |
| 229 | + <module name="NewlineAtEndOfFile"/> |
| 230 | + |
48 | 231 | </module> |
0 commit comments