1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5 See installation instructions: https://sites.google.com/a/chromium.org/dev/checkstyle
7 <module name="Checker">
8 <property name="severity" value="warning"/>
9 <property name="charset" value="UTF-8"/>
10 <module name="TreeWalker">
11 <module name="AvoidStarImport">
12 <property name="severity" value="error"/>
14 <module name="IllegalCatch">
15 <property name="severity" value="info"/>
17 <module name="RedundantImport">
18 <message key="import.redundant" value="Redundant import: {0}. Use :JavaImportOrganize (ECLIM) or Ctrl+Shift+O (Eclipse) to sort imports"/>
19 <property name="severity" value="error"/>
21 <module name="UnusedImports">
22 <message key="import.unused" value="Unused import: {0}. Use :JavaImportOrganize (ECLIM) or Ctrl+Shift+O (Eclipse) to sort imports"/>
23 <property name="severity" value="error"/>
24 <property name="processJavadoc" value="true"/>
26 <module name="JavadocType">
27 <property name="severity" value="warning"/>
28 <property name="tokens" value="INTERFACE_DEF, CLASS_DEF"/>
29 <property name="scope" value="public"/>
30 <message key="javadoc.missing" value="Public classes and interfaces require JavaDoc comments."/>
32 <module name="JavadocMethod">
33 <property name="severity" value="info"/>
34 <property name="scope" value="public"/>
35 <property name="allowMissingParamTags" value="true"/>
36 <property name="allowMissingPropertyJavadoc" value="true"/>
37 <property name="allowMissingReturnTag" value="true"/>
38 <property name="allowMissingThrowsTags" value="true"/>
40 <module name="PackageName">
41 <property name="severity" value="error"/>
42 <property name="format" value="^[a-z]+(\.[a-z][a-z0-9_]{1,})*$"/>
44 <module name="SimplifyBooleanExpression">
45 <property name="severity" value="error"/>
47 <module name="SimplifyBooleanReturn">
48 <property name="severity" value="error"/>
50 <module name="TypeName">
51 <property name="severity" value="error"/>
53 <module name="ConstantName">
54 <property name="severity" value="error"/>
55 <property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)|(s[A-Z][a-zA-Z0-9]*)$"/>
56 <message key="name.invalidPattern" value="Static final field names must either be all caps (e.g. int HEIGHT_PX) for 'true' constants, or start with s (e.g. AtomicInteger sNextId or Runnable sSuspendTask) for fields with mutable state or that don't 'feel' like constants."/>
58 <!-- Non-public, non-static field names start with m. -->
59 <module name="MemberName">
60 <property name="severity" value="error"/>
61 <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
62 <property name="applyToPublic" value="false"/>
63 <message key="name.invalidPattern" value="Non-public, non-static field names start with m."/>
65 <!-- Static field names start with s. -->
66 <module name="StaticVariableName">
67 <property name="severity" value="error"/>
68 <property name="format" value="^s[A-Z][a-zA-Z0-9]*$"/>
69 <property name="applyToPublic" value="false"/>
70 <message key="name.invalidPattern" value="Static field names start with s."/>
72 <module name="MethodName">
73 <property name="severity" value="error"/>
74 <property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
75 <message key="name.invalidPattern" value="Method names should start with a lower case letter (e.g. getWidth())"/>
77 <module name="ParameterName">
78 <property name="severity" value="error"/>
80 <module name="LocalFinalVariableName">
81 <property name="severity" value="error"/>
82 <property name="format" value="^m|s|((([ms][a-z0-9])|([a-ln-rt-z]))[a-zA-Z0-9]*)$"/>
83 <message key="name.invalidPattern" value="Local variables should be camel-cased (e.g. int minWidth = 4)."/>
85 <module name="LocalVariableName">
86 <property name="severity" value="error"/>
87 <property name="format" value="^m|s|((([ms][a-z0-9])|([a-ln-rt-z]))[a-zA-Z0-9]*)$"/>
88 <message key="name.invalidPattern" value="Local variables should be camel-cased (e.g. int minWidth = 4)."/>
90 <module name="LineLength">
91 <property name="severity" value="error"/>
92 <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
93 <property name="max" value="100"/>
95 <module name="LeftCurly">
96 <property name="severity" value="error"/>
98 <module name="RightCurly">
99 <property name="severity" value="error"/>
101 <module name="NeedBraces">
102 <message key="needBraces" value="if, for, while, and do require curly braces unless they are single-line statements."/>
103 <property name="severity" value="error"/>
104 <property name="tokens" value="LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, LITERAL_IF"/>
105 <property name="allowSingleLineStatement" value="true"/>
107 <module name="EmptyBlock">
108 <property name="severity" value="error"/>
109 <property name="option" value="text"/>
110 <metadata name="altname" value="EmptyCatchBlock"/>
112 <module name="UpperEll">
113 <property name="severity" value="error"/>
115 <module name="FallThrough">
116 <property name="severity" value="error"/>
117 <property name="reliefPattern" value=".*"/>
119 <module name="ModifierOrder">
120 <property name="severity" value="error"/>
122 <module name="WhitespaceAround">
123 <property name="severity" value="error"/>
124 <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND" />
125 <property name="allowEmptyConstructors" value="true"/>
126 <property name="allowEmptyMethods" value="true"/>
128 <module name="WhitespaceAfter">
129 <property name="severity" value="error"/>
130 <property name="tokens" value="COMMA, SEMI, TYPECAST"/>
132 <module name="NoWhitespaceAfter">
133 <property name="severity" value="error"/>
134 <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
136 <module name="NoWhitespaceBefore">
137 <property name="severity" value="error"/>
138 <property name="allowLineBreaks" value="true"/>
139 <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
141 <module name="GenericWhitespace">
142 <property name="severity" value="error"/>
143 <message key="ws.followed"
144 value="GenericWhitespace ''{0}'' is followed by whitespace."/>
145 <message key="ws.preceded"
146 value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
147 <message key="ws.illegalFollow"
148 value="GenericWhitespace ''{0}'' should followed by whitespace."/>
149 <message key="ws.notPreceded"
150 value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
152 <module name="EmptyStatement">
153 <property name="severity" value="error"/>
155 <module name="NoFinalizer">
156 <property name="severity" value="info"/>
158 <module name="ParenPad">
159 <property name="severity" value="error"/>
161 <module name="MethodParamPad">
162 <property name="severity" value="error"/>
164 <module name="ImportOrder">
165 <property name="severity" value="error"/>
166 <message key="import.ordering" value="Wrong order for {0} import. Use :JavaImportOrganize (ECLIM) or Ctrl+Shift+O (Eclipse) to sort imports"/>
167 <property name="groups" value="android, com, dalvik, gov, junit, libcore, net, org, java, javax"/>
168 <property name="ordered" value="true"/>
169 <property name="option" value="top"/>
170 <property name="separated" value="true"/>
172 <module name="Indentation">
173 <property name="severity" value="error"/>
174 <property name="basicOffset" value="4"/>
175 <property name="throwsIndent" value="8"/>
176 <property name="lineWrappingIndentation" value="8"/>
178 <!-- TODO(aurimas): make OperatorWrap into an error once all the warnings are fixed. -->
179 <module name="OperatorWrap">
180 <property name="severity" value="error"/>
181 <property name="option" value="NL" />
182 <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 " />
184 <module name="OperatorWrap">
185 <property name="severity" value="error"/>
186 <property name="option" value="eol"/>
187 <property name="tokens" value="ASSIGN"/>
189 <module name="SeparatorWrap">
190 <property name="severity" value="error"/>
191 <property name="tokens" value="DOT"/>
192 <property name="option" value="nl"/>
194 <module name="SeparatorWrap">
195 <property name="severity" value="error"/>
196 <property name="tokens" value="COMMA"/>
197 <property name="option" value="EOL"/>
200 <module name="FileTabCharacter">
201 <property name="severity" value="error"/>
203 <module name="RegexpSingleline">
204 <property name="severity" value="error"/>
205 <property name="format" value="[ \t]+$"/>
206 <property name="message" value="Trailing whitespace"/>
208 <module name="RegexpHeader">
209 <property name="severity" value="error"/>
210 <property name="header" value="^// Copyright 20\d\d The Chromium Authors. All rights reserved.$\n^// Use of this source code is governed by a BSD-style license that can be$\n^// found in the LICENSE file.$"/>