1<?xml version="1.0"?> 2<!DOCTYPE module PUBLIC 3 "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" 4 "https://checkstyle.org/dtds/configuration_1_3.dtd"> 5 6<!-- 7 Checkstyle configuration that checks the Google coding conventions from Google Java Style 8 that can be found at https://google.github.io/styleguide/javaguide.html. 9 10 Checkstyle is very configurable. Be sure to read the documentation at 11 http://checkstyle.sf.net (or in your downloaded distribution). 12 13 To completely disable a check, just comment it out or delete it from the file. 14 15 Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov. 16 --> 17 18<module name = "Checker"> 19 <property name="charset" value="UTF-8"/> 20 21 <property name="severity" value="error"/> 22 23 24 <module name="RegexpHeader"> 25 <property name="headerFile" value="${rootDir}/buildscripts/checkstyle.license"/> 26 <property name="fileExtensions" value="java"/> 27 </module> 28 29 <property name="fileExtensions" value="java, properties, xml"/> 30 <!-- Checks for whitespace --> 31 <!-- See http://checkstyle.sf.net/config_whitespace.html --> 32 <module name="FileTabCharacter"> 33 <property name="eachLine" value="true"/> 34 </module> 35 36 <module name="TreeWalker"> 37 <module name="OuterTypeFilename"/> 38 <module name="IllegalTokenText"> 39 <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/> 40 <property name="format" 41 value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> 42 <property name="message" 43 value="Consider using special escape sequence instead of octal value or Unicode escaped value."/> 44 </module> 45 <module name="AvoidEscapedUnicodeCharacters"> 46 <property name="allowEscapesForControlCharacters" value="true"/> 47 <property name="allowByTailComment" value="true"/> 48 <property name="allowNonPrintableEscapes" value="true"/> 49 </module> 50 <module name="LineLength"> 51 <property name="max" value="100"/> 52 <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> 53 </module> 54 <module name="AvoidStarImport"/> 55 <module name="RedundantImport"/> 56 <module name="OneTopLevelClass"/> 57 <module name="NoLineWrap"/> 58 <module name="EmptyBlock"> 59 <property name="option" value="TEXT"/> 60 <property name="tokens" 61 value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> 62 </module> 63 <module name="NeedBraces"/> 64 <module name="LeftCurly"/> 65 <module name="RightCurly"> 66 <property name="id" value="RightCurlySame"/> 67 <property name="tokens" 68 value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, 69 LITERAL_DO"/> 70 </module> 71 <module name="RightCurly"> 72 <property name="id" value="RightCurlyAlone"/> 73 <property name="option" value="alone"/> 74 <property name="tokens" 75 value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, 76 INSTANCE_INIT"/> 77 </module> 78 <module name="WhitespaceAround"> 79 <property name="allowEmptyConstructors" value="true"/> 80 <property name="allowEmptyMethods" value="true"/> 81 <property name="allowEmptyTypes" value="true"/> 82 <property name="allowEmptyLoops" value="true"/> 83 <message key="ws.notFollowed" 84 value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/> 85 <message key="ws.notPreceded" 86 value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> 87 </module> 88 <module name="OneStatementPerLine"/> 89 <module name="MultipleVariableDeclarations"/> 90 <module name="ArrayTypeStyle"/> 91 <!-- <!-\- This rule conflicts with Error Prone's exhaustiveness checking. -\-> --> 92 <!-- <module name="MissingSwitchDefault"/> --> 93 <module name="FallThrough"/> 94 <module name="UpperEll"/> 95 <module name="ModifierOrder"/> 96 <module name="EmptyLineSeparator"> 97 <property name="allowNoEmptyLineBetweenFields" value="true"/> 98 </module> 99 <module name="SeparatorWrap"> 100 <property name="id" value="SeparatorWrapDot"/> 101 <property name="tokens" value="DOT"/> 102 <property name="option" value="nl"/> 103 </module> 104 <module name="SeparatorWrap"> 105 <property name="id" value="SeparatorWrapComma"/> 106 <property name="tokens" value="COMMA"/> 107 <property name="option" value="EOL"/> 108 </module> 109 <module name="SeparatorWrap"> 110 <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 --> 111 <property name="id" value="SeparatorWrapEllipsis"/> 112 <property name="tokens" value="ELLIPSIS"/> 113 <property name="option" value="EOL"/> 114 </module> 115 <module name="SeparatorWrap"> 116 <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 --> 117 <property name="id" value="SeparatorWrapArrayDeclarator"/> 118 <property name="tokens" value="ARRAY_DECLARATOR"/> 119 <property name="option" value="EOL"/> 120 </module> 121 <module name="SeparatorWrap"> 122 <property name="id" value="SeparatorWrapMethodRef"/> 123 <property name="tokens" value="METHOD_REF"/> 124 <property name="option" value="nl"/> 125 </module> 126 <module name="PackageName"> 127 <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> 128 <message key="name.invalidPattern" 129 value="Package name ''{0}'' must match pattern ''{1}''."/> 130 </module> 131 <module name="TypeName"> 132 <message key="name.invalidPattern" 133 value="Type name ''{0}'' must match pattern ''{1}''."/> 134 </module> 135 <module name="MemberName"> 136 <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> 137 <message key="name.invalidPattern" 138 value="Member name ''{0}'' must match pattern ''{1}''."/> 139 </module> 140 <module name="ParameterName"> 141 <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> 142 <message key="name.invalidPattern" 143 value="Parameter name ''{0}'' must match pattern ''{1}''."/> 144 </module> 145 <module name="LambdaParameterName"> 146 <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> 147 <message key="name.invalidPattern" 148 value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/> 149 </module> 150 <module name="CatchParameterName"> 151 <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> 152 <message key="name.invalidPattern" 153 value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> 154 </module> 155 <module name="LocalVariableName"> 156 <property name="tokens" value="VARIABLE_DEF"/> 157 <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> 158 <message key="name.invalidPattern" 159 value="Local variable name ''{0}'' must match pattern ''{1}''."/> 160 </module> 161 <module name="ClassTypeParameterName"> 162 <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> 163 <message key="name.invalidPattern" 164 value="Class type name ''{0}'' must match pattern ''{1}''."/> 165 </module> 166 <module name="MethodTypeParameterName"> 167 <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> 168 <message key="name.invalidPattern" 169 value="Method type name ''{0}'' must match pattern ''{1}''."/> 170 </module> 171 <module name="InterfaceTypeParameterName"> 172 <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> 173 <message key="name.invalidPattern" 174 value="Interface type name ''{0}'' must match pattern ''{1}''."/> 175 </module> 176 <module name="NoFinalizer"/> 177 <module name="GenericWhitespace"> 178 <message key="ws.followed" 179 value="GenericWhitespace ''{0}'' is followed by whitespace."/> 180 <message key="ws.preceded" 181 value="GenericWhitespace ''{0}'' is preceded with whitespace."/> 182 <message key="ws.illegalFollow" 183 value="GenericWhitespace ''{0}'' should followed by whitespace."/> 184 <message key="ws.notPreceded" 185 value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> 186 </module> 187 <!-- <!-\- Checkstyle indentation rules conflict with google-java-format: -\-> --> 188 <!-- <module name="Indentation"> --> 189 <!-- <property name="basicOffset" value="2"/> --> 190 <!-- <property name="braceAdjustment" value="0"/> --> 191 <!-- <property name="caseIndent" value="2"/> --> 192 <!-- <property name="throwsIndent" value="4"/> --> 193 <!-- <property name="lineWrappingIndentation" value="4"/> --> 194 <!-- <property name="arrayInitIndent" value="2"/> --> 195 <!-- </module> --> 196 <module name="AbbreviationAsWordInName"> 197 <property name="ignoreFinal" value="false"/> 198 <property name="allowedAbbreviationLength" value="1"/> 199 </module> 200 <module name="OverloadMethodsDeclarationOrder"/> 201 <!-- <!-\- Many unit tests define all variables at the start of the method. -\-> --> 202 <!-- <module name="VariableDeclarationUsageDistance"/> --> 203 <module name="CustomImportOrder"> 204 <property name="sortImportsInGroupAlphabetically" value="true"/> 205 <property name="separateLineBetweenGroups" value="true"/> 206 <property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/> 207 </module> 208 <module name="MethodParamPad"/> 209 <module name="NoWhitespaceBefore"> 210 <property name="tokens" 211 value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/> 212 <property name="allowLineBreaks" value="true"/> 213 </module> 214 <module name="ParenPad"/> 215 <module name="OperatorWrap"> 216 <property name="option" value="NL"/> 217 <property name="tokens" 218 value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, 219 LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/> 220 </module> 221 <module name="AnnotationLocation"> 222 <property name="id" value="AnnotationLocationMostCases"/> 223 <property name="tokens" 224 value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/> 225 </module> 226 <module name="AnnotationLocation"> 227 <property name="id" value="AnnotationLocationVariables"/> 228 <property name="tokens" value="VARIABLE_DEF"/> 229 <property name="allowSamelineMultipleAnnotations" value="true"/> 230 </module> 231 <module name="NonEmptyAtclauseDescription"/> 232 <module name="JavadocTagContinuationIndentation"/> 233 <module name="SummaryJavadoc"> 234 <property name="forbiddenSummaryFragments" 235 value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/> 236 </module> 237 <module name="JavadocParagraph"/> 238 <module name="AtclauseOrder"> 239 <property name="tagOrder" value="@param, @return, @throws, @deprecated"/> 240 <property name="target" 241 value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> 242 </module> 243 <module name="JavadocMethod"> 244 <property name="scope" value="public"/> 245 <property name="allowMissingParamTags" value="true"/> 246 <property name="allowMissingThrowsTags" value="true"/> 247 <property name="allowMissingReturnTag" value="true"/> 248 <property name="minLineCount" value="2"/> 249 <!-- <!-\- Too restrictive for tests -\-> --> 250 <!-- <property name="allowedAnnotations" value="Override, Test"/ --> 251 <property name="allowedAnnotations" 252 value="Override, Test, Before, After, BeforeClass, AfterClass, Setup, 253 TearDown"/> 254 <property name="allowThrowsTagsForSubclasses" value="true"/> 255 </module> 256 <module name="MethodName"> 257 <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/> 258 <message key="name.invalidPattern" 259 value="Method name ''{0}'' must match pattern ''{1}''."/> 260 </module> 261 <module name="SingleLineJavadoc"> 262 <!-- <!-\- Wrong interpretation of the style guide; -\-> --> 263 <!-- <property name="ignoreInlineTags" value="false"/ --> 264 </module> 265 <module name="EmptyCatchBlock"> 266 <property name="exceptionVariableName" value="expected"/> 267 </module> 268 <module name="CommentsIndentation"/> 269 <module name="SuppressWarningsHolder"/> 270 <module name="ImportControl"> 271 <property name="file" value="${rootDir}/buildscripts/import-control.xml"/> 272 <property name="path" value="^.*[\\/]src[\\/]main[\\/]java[\\/].*$"/> 273 </module> 274 <module name="SuppressionCommentFilter"/> 275 </module> 276 <module name="SuppressWarningsFilter"/> 277</module> 278