1*e07d83d3SAndroid Build Coastguard Worker<?xml version="1.0"?> 2*e07d83d3SAndroid Build Coastguard Worker<!DOCTYPE module PUBLIC 3*e07d83d3SAndroid Build Coastguard Worker "-//Puppy Crawl//DTD Check Configuration 1.3//EN" 4*e07d83d3SAndroid Build Coastguard Worker "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> 5*e07d83d3SAndroid Build Coastguard Worker 6*e07d83d3SAndroid Build Coastguard Worker<!-- 7*e07d83d3SAndroid Build Coastguard Worker Checkstyle configuration that checks the Google coding conventions from Google Java Style 8*e07d83d3SAndroid Build Coastguard Worker that can be found at https://google.github.io/styleguide/javaguide.html. 9*e07d83d3SAndroid Build Coastguard Worker 10*e07d83d3SAndroid Build Coastguard Worker Checkstyle is very configurable. Be sure to read the documentation at 11*e07d83d3SAndroid Build Coastguard Worker http://checkstyle.sf.net (or in your downloaded distribution). 12*e07d83d3SAndroid Build Coastguard Worker 13*e07d83d3SAndroid Build Coastguard Worker To completely disable a check, just comment it out or delete it from the file. 14*e07d83d3SAndroid Build Coastguard Worker 15*e07d83d3SAndroid Build Coastguard Worker Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov. 16*e07d83d3SAndroid Build Coastguard Worker --> 17*e07d83d3SAndroid Build Coastguard Worker 18*e07d83d3SAndroid Build Coastguard Worker<module name = "Checker"> 19*e07d83d3SAndroid Build Coastguard Worker <property name="charset" value="UTF-8"/> 20*e07d83d3SAndroid Build Coastguard Worker 21*e07d83d3SAndroid Build Coastguard Worker <property name="severity" value="error"/> 22*e07d83d3SAndroid Build Coastguard Worker 23*e07d83d3SAndroid Build Coastguard Worker <module name="Header"> 24*e07d83d3SAndroid Build Coastguard Worker <property name="headerFile" value="${config_loc}/checkstyle.license"/> 25*e07d83d3SAndroid Build Coastguard Worker <property name="ignoreLines" value="2"/> 26*e07d83d3SAndroid Build Coastguard Worker <property name="fileExtensions" value="java"/> 27*e07d83d3SAndroid Build Coastguard Worker </module> 28*e07d83d3SAndroid Build Coastguard Worker 29*e07d83d3SAndroid Build Coastguard Worker <property name="fileExtensions" value="java, properties, xml"/> 30*e07d83d3SAndroid Build Coastguard Worker <!-- Checks for whitespace --> 31*e07d83d3SAndroid Build Coastguard Worker <!-- See http://checkstyle.sf.net/config_whitespace.html --> 32*e07d83d3SAndroid Build Coastguard Worker <module name="FileTabCharacter"> 33*e07d83d3SAndroid Build Coastguard Worker <property name="eachLine" value="true"/> 34*e07d83d3SAndroid Build Coastguard Worker </module> 35*e07d83d3SAndroid Build Coastguard Worker 36*e07d83d3SAndroid Build Coastguard Worker <module name="LineLength"> 37*e07d83d3SAndroid Build Coastguard Worker <property name="max" value="100"/> 38*e07d83d3SAndroid Build Coastguard Worker <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> 39*e07d83d3SAndroid Build Coastguard Worker </module> 40*e07d83d3SAndroid Build Coastguard Worker 41*e07d83d3SAndroid Build Coastguard Worker <module name="TreeWalker"> 42*e07d83d3SAndroid Build Coastguard Worker <module name="OuterTypeFilename"/> 43*e07d83d3SAndroid Build Coastguard Worker <module name="IllegalTokenText"> 44*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/> 45*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> 46*e07d83d3SAndroid Build Coastguard Worker <property name="message" value="Avoid using corresponding octal or Unicode escape."/> 47*e07d83d3SAndroid Build Coastguard Worker </module> 48*e07d83d3SAndroid Build Coastguard Worker <module name="AvoidEscapedUnicodeCharacters"> 49*e07d83d3SAndroid Build Coastguard Worker <property name="allowEscapesForControlCharacters" value="true"/> 50*e07d83d3SAndroid Build Coastguard Worker <property name="allowByTailComment" value="true"/> 51*e07d83d3SAndroid Build Coastguard Worker <property name="allowNonPrintableEscapes" value="true"/> 52*e07d83d3SAndroid Build Coastguard Worker </module> 53*e07d83d3SAndroid Build Coastguard Worker <module name="AvoidStarImport"/> 54*e07d83d3SAndroid Build Coastguard Worker <!-- TODO(ejona): Upstream? --> 55*e07d83d3SAndroid Build Coastguard Worker <module name="UnusedImports"/> 56*e07d83d3SAndroid Build Coastguard Worker <module name="OneTopLevelClass"/> 57*e07d83d3SAndroid Build Coastguard Worker <module name="NoLineWrap"/> 58*e07d83d3SAndroid Build Coastguard Worker <module name="EmptyBlock"> 59*e07d83d3SAndroid Build Coastguard Worker <property name="option" value="TEXT"/> 60*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> 61*e07d83d3SAndroid Build Coastguard Worker </module> 62*e07d83d3SAndroid Build Coastguard Worker <module name="NeedBraces"/> 63*e07d83d3SAndroid Build Coastguard Worker <module name="LeftCurly"/> 64*e07d83d3SAndroid Build Coastguard Worker <module name="RightCurly"> 65*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/> 66*e07d83d3SAndroid Build Coastguard Worker </module> 67*e07d83d3SAndroid Build Coastguard Worker <module name="WhitespaceAround"> 68*e07d83d3SAndroid Build Coastguard Worker <property name="allowEmptyConstructors" value="true"/> 69*e07d83d3SAndroid Build Coastguard Worker <property name="allowEmptyMethods" value="true"/> 70*e07d83d3SAndroid Build Coastguard Worker <property name="allowEmptyTypes" value="true"/> 71*e07d83d3SAndroid Build Coastguard Worker <property name="allowEmptyLoops" value="true"/> 72*e07d83d3SAndroid Build Coastguard Worker <message key="ws.notFollowed" 73*e07d83d3SAndroid Build Coastguard Worker 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)"/> 74*e07d83d3SAndroid Build Coastguard Worker <message key="ws.notPreceded" 75*e07d83d3SAndroid Build Coastguard Worker value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> 76*e07d83d3SAndroid Build Coastguard Worker </module> 77*e07d83d3SAndroid Build Coastguard Worker <module name="OneStatementPerLine"/> 78*e07d83d3SAndroid Build Coastguard Worker <module name="MultipleVariableDeclarations"/> 79*e07d83d3SAndroid Build Coastguard Worker <module name="ArrayTypeStyle"/> 80*e07d83d3SAndroid Build Coastguard Worker <module name="MissingSwitchDefault"/> 81*e07d83d3SAndroid Build Coastguard Worker <module name="FallThrough"/> 82*e07d83d3SAndroid Build Coastguard Worker <module name="UpperEll"/> 83*e07d83d3SAndroid Build Coastguard Worker <module name="ModifierOrder"/> 84*e07d83d3SAndroid Build Coastguard Worker <module name="EmptyLineSeparator"> 85*e07d83d3SAndroid Build Coastguard Worker <property name="allowNoEmptyLineBetweenFields" value="true"/> 86*e07d83d3SAndroid Build Coastguard Worker </module> 87*e07d83d3SAndroid Build Coastguard Worker <module name="SeparatorWrap"> 88*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="DOT"/> 89*e07d83d3SAndroid Build Coastguard Worker <property name="option" value="nl"/> 90*e07d83d3SAndroid Build Coastguard Worker </module> 91*e07d83d3SAndroid Build Coastguard Worker <module name="SeparatorWrap"> 92*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="COMMA"/> 93*e07d83d3SAndroid Build Coastguard Worker <property name="option" value="EOL"/> 94*e07d83d3SAndroid Build Coastguard Worker </module> 95*e07d83d3SAndroid Build Coastguard Worker <module name="PackageName"> 96*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> 97*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 98*e07d83d3SAndroid Build Coastguard Worker value="Package name ''{0}'' must match pattern ''{1}''."/> 99*e07d83d3SAndroid Build Coastguard Worker </module> 100*e07d83d3SAndroid Build Coastguard Worker <module name="TypeName"> 101*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 102*e07d83d3SAndroid Build Coastguard Worker value="Type name ''{0}'' must match pattern ''{1}''."/> 103*e07d83d3SAndroid Build Coastguard Worker </module> 104*e07d83d3SAndroid Build Coastguard Worker <module name="MemberName"> 105*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> 106*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 107*e07d83d3SAndroid Build Coastguard Worker value="Member name ''{0}'' must match pattern ''{1}''."/> 108*e07d83d3SAndroid Build Coastguard Worker </module> 109*e07d83d3SAndroid Build Coastguard Worker <module name="ParameterName"> 110*e07d83d3SAndroid Build Coastguard Worker <!-- TODO(ejona): too strict, as one-character parameter names are permitted 111*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/--> 112*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> 113*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 114*e07d83d3SAndroid Build Coastguard Worker value="Parameter name ''{0}'' must match pattern ''{1}''."/> 115*e07d83d3SAndroid Build Coastguard Worker </module> 116*e07d83d3SAndroid Build Coastguard Worker <module name="CatchParameterName"> 117*e07d83d3SAndroid Build Coastguard Worker <!-- TODO(ejona): too strict, as one-character parameter names are permitted. 118*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/--> 119*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> 120*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 121*e07d83d3SAndroid Build Coastguard Worker value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> 122*e07d83d3SAndroid Build Coastguard Worker </module> 123*e07d83d3SAndroid Build Coastguard Worker <module name="LocalVariableName"> 124*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="VARIABLE_DEF"/> 125*e07d83d3SAndroid Build Coastguard Worker <!-- TODO(ejona): too strict, as one-character parameter names are permitted. 126*e07d83d3SAndroid Build Coastguard Worker Add support for Unicode. 127*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/--> 128*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[^A-Z]"/> 129*e07d83d3SAndroid Build Coastguard Worker <property name="allowOneCharVarInForLoop" value="true"/> 130*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 131*e07d83d3SAndroid Build Coastguard Worker value="Local variable name ''{0}'' must match pattern ''{1}''."/> 132*e07d83d3SAndroid Build Coastguard Worker </module> 133*e07d83d3SAndroid Build Coastguard Worker <module name="ClassTypeParameterName"> 134*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> 135*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 136*e07d83d3SAndroid Build Coastguard Worker value="Class type name ''{0}'' must match pattern ''{1}''."/> 137*e07d83d3SAndroid Build Coastguard Worker </module> 138*e07d83d3SAndroid Build Coastguard Worker <module name="MethodTypeParameterName"> 139*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> 140*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 141*e07d83d3SAndroid Build Coastguard Worker value="Method type name ''{0}'' must match pattern ''{1}''."/> 142*e07d83d3SAndroid Build Coastguard Worker </module> 143*e07d83d3SAndroid Build Coastguard Worker <module name="InterfaceTypeParameterName"> 144*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> 145*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 146*e07d83d3SAndroid Build Coastguard Worker value="Interface type name ''{0}'' must match pattern ''{1}''."/> 147*e07d83d3SAndroid Build Coastguard Worker </module> 148*e07d83d3SAndroid Build Coastguard Worker <module name="NoFinalizer"/> 149*e07d83d3SAndroid Build Coastguard Worker <module name="GenericWhitespace"> 150*e07d83d3SAndroid Build Coastguard Worker <message key="ws.followed" 151*e07d83d3SAndroid Build Coastguard Worker value="GenericWhitespace ''{0}'' is followed by whitespace."/> 152*e07d83d3SAndroid Build Coastguard Worker <message key="ws.preceded" 153*e07d83d3SAndroid Build Coastguard Worker value="GenericWhitespace ''{0}'' is preceded with whitespace."/> 154*e07d83d3SAndroid Build Coastguard Worker <message key="ws.illegalFollow" 155*e07d83d3SAndroid Build Coastguard Worker value="GenericWhitespace ''{0}'' should followed by whitespace."/> 156*e07d83d3SAndroid Build Coastguard Worker <message key="ws.notPreceded" 157*e07d83d3SAndroid Build Coastguard Worker value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> 158*e07d83d3SAndroid Build Coastguard Worker </module> 159*e07d83d3SAndroid Build Coastguard Worker <module name="Indentation"> 160*e07d83d3SAndroid Build Coastguard Worker <property name="basicOffset" value="2"/> 161*e07d83d3SAndroid Build Coastguard Worker <property name="braceAdjustment" value="0"/> 162*e07d83d3SAndroid Build Coastguard Worker <property name="caseIndent" value="2"/> 163*e07d83d3SAndroid Build Coastguard Worker <property name="throwsIndent" value="4"/> 164*e07d83d3SAndroid Build Coastguard Worker <property name="lineWrappingIndentation" value="4"/> 165*e07d83d3SAndroid Build Coastguard Worker <property name="arrayInitIndent" value="2"/> 166*e07d83d3SAndroid Build Coastguard Worker </module> 167*e07d83d3SAndroid Build Coastguard Worker <module name="AbbreviationAsWordInName"> 168*e07d83d3SAndroid Build Coastguard Worker <property name="ignoreFinal" value="false"/> 169*e07d83d3SAndroid Build Coastguard Worker <property name="allowedAbbreviationLength" value="1"/> 170*e07d83d3SAndroid Build Coastguard Worker </module> 171*e07d83d3SAndroid Build Coastguard Worker <module name="OverloadMethodsDeclarationOrder"/> 172*e07d83d3SAndroid Build Coastguard Worker <!-- TODO(ejona): Does not consider assignment during declaration as a usage. 173*e07d83d3SAndroid Build Coastguard Worker <module name="VariableDeclarationUsageDistance"/--> 174*e07d83d3SAndroid Build Coastguard Worker <module name="CustomImportOrder"> 175*e07d83d3SAndroid Build Coastguard Worker <property name="sortImportsInGroupAlphabetically" value="true"/> 176*e07d83d3SAndroid Build Coastguard Worker <property name="separateLineBetweenGroups" value="true"/> 177*e07d83d3SAndroid Build Coastguard Worker <property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/> 178*e07d83d3SAndroid Build Coastguard Worker </module> 179*e07d83d3SAndroid Build Coastguard Worker <module name="MethodParamPad"/> 180*e07d83d3SAndroid Build Coastguard Worker <module name="OperatorWrap"> 181*e07d83d3SAndroid Build Coastguard Worker <property name="option" value="NL"/> 182*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/> 183*e07d83d3SAndroid Build Coastguard Worker </module> 184*e07d83d3SAndroid Build Coastguard Worker <module name="AnnotationLocation"> 185*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/> 186*e07d83d3SAndroid Build Coastguard Worker </module> 187*e07d83d3SAndroid Build Coastguard Worker <module name="AnnotationLocation"> 188*e07d83d3SAndroid Build Coastguard Worker <property name="tokens" value="VARIABLE_DEF"/> 189*e07d83d3SAndroid Build Coastguard Worker <property name="allowSamelineMultipleAnnotations" value="true"/> 190*e07d83d3SAndroid Build Coastguard Worker </module> 191*e07d83d3SAndroid Build Coastguard Worker <module name="NonEmptyAtclauseDescription"/> 192*e07d83d3SAndroid Build Coastguard Worker <module name="JavadocTagContinuationIndentation"/> 193*e07d83d3SAndroid Build Coastguard Worker <module name="SummaryJavadoc"> 194*e07d83d3SAndroid Build Coastguard Worker <property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/> 195*e07d83d3SAndroid Build Coastguard Worker </module> 196*e07d83d3SAndroid Build Coastguard Worker <module name="JavadocParagraph"/> 197*e07d83d3SAndroid Build Coastguard Worker <module name="AtclauseOrder"> 198*e07d83d3SAndroid Build Coastguard Worker <property name="tagOrder" value="@param, @return, @throws, @deprecated"/> 199*e07d83d3SAndroid Build Coastguard Worker <property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> 200*e07d83d3SAndroid Build Coastguard Worker </module> 201*e07d83d3SAndroid Build Coastguard Worker <module name="JavadocMethod"> 202*e07d83d3SAndroid Build Coastguard Worker <property name="scope" value="public"/> 203*e07d83d3SAndroid Build Coastguard Worker <property name="allowMissingParamTags" value="true"/> 204*e07d83d3SAndroid Build Coastguard Worker <property name="allowMissingReturnTag" value="true"/> 205*e07d83d3SAndroid Build Coastguard Worker <!-- TOOD(ejona): Too restrictive for tests 206*e07d83d3SAndroid Build Coastguard Worker <property name="allowedAnnotations" value="Override, Test"/--> 207*e07d83d3SAndroid Build Coastguard Worker <property name="allowedAnnotations" value="Override, Test, Before, After, BeforeClass, AfterClass, Setup, TearDown"/> 208*e07d83d3SAndroid Build Coastguard Worker </module> 209*e07d83d3SAndroid Build Coastguard Worker <module name="MethodName"> 210*e07d83d3SAndroid Build Coastguard Worker <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/> 211*e07d83d3SAndroid Build Coastguard Worker <message key="name.invalidPattern" 212*e07d83d3SAndroid Build Coastguard Worker value="Method name ''{0}'' must match pattern ''{1}''."/> 213*e07d83d3SAndroid Build Coastguard Worker </module> 214*e07d83d3SAndroid Build Coastguard Worker <module name="SingleLineJavadoc"> 215*e07d83d3SAndroid Build Coastguard Worker <!-- TODO(ejona): Based on mis-reading of style; consider upstreaming 216*e07d83d3SAndroid Build Coastguard Worker <property name="ignoreInlineTags" value="false"/--> 217*e07d83d3SAndroid Build Coastguard Worker </module> 218*e07d83d3SAndroid Build Coastguard Worker <module name="EmptyCatchBlock"> 219*e07d83d3SAndroid Build Coastguard Worker <property name="exceptionVariableName" value="expected"/> 220*e07d83d3SAndroid Build Coastguard Worker </module> 221*e07d83d3SAndroid Build Coastguard Worker <module name="CommentsIndentation"/> 222*e07d83d3SAndroid Build Coastguard Worker </module> 223*e07d83d3SAndroid Build Coastguard Worker</module> 224