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 <!-- This check is set to a warning because JNI generator sometimes requires to leave an unused import -->
20 <property name="severity" value="warning"/>
22 <module name="UnusedImports">
23 <message key="import.unused" value="Unused import: {0}. Use :JavaImportOrganize (ECLIM) or Ctrl+Shift+O (Eclipse) to sort imports"/>
24 <!-- This check is set to a warning because JNI generator sometimes requires to leave an unused import -->
25 <property name="severity" value="warning"/>
26 <property name="processJavadoc" value="true"/>
28 <module name="JavadocType">
29 <property name="severity" value="warning"/>
30 <property name="tokens" value="INTERFACE_DEF, CLASS_DEF"/>
31 <property name="scope" value="public"/>
32 <message key="javadoc.missing" value="Public classes and interfaces require JavaDoc comments."/>
34 <module name="JavadocMethod">
35 <property name="severity" value="info"/>
36 <property name="scope" value="public"/>
37 <property name="allowMissingParamTags" value="true"/>
38 <property name="allowMissingPropertyJavadoc" value="true"/>
39 <property name="allowMissingReturnTag" value="true"/>
40 <property name="allowMissingThrowsTags" value="true"/>
42 <module name="PackageName">
43 <property name="severity" value="error"/>
44 <property name="format" value="^[a-z]+(\.[a-z][a-z0-9_]{1,})*$"/>
46 <module name="SimplifyBooleanExpression">
47 <property name="severity" value="error"/>
49 <module name="SimplifyBooleanReturn">
50 <property name="severity" value="error"/>
52 <module name="TypeName">
53 <property name="severity" value="error"/>
55 <module name="ConstantName">
56 <property name="severity" value="error"/>
57 <property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)|(s[A-Z][a-zA-Z0-9]*)$"/>
58 <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."/>
60 <!-- Non-public, non-static field names start with m. -->
61 <module name="MemberName">
62 <property name="severity" value="error"/>
63 <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
64 <property name="applyToPublic" value="false"/>
65 <message key="name.invalidPattern" value="Non-public, non-static field names start with m."/>
67 <!-- Static field names start with s. -->
68 <module name="StaticVariableName">
69 <property name="severity" value="error"/>
70 <property name="format" value="^s[A-Z][a-zA-Z0-9]*$"/>
71 <property name="applyToPublic" value="false"/>
72 <message key="name.invalidPattern" value="Static field names start with s."/>
74 <module name="MethodName">
75 <property name="severity" value="error"/>
76 <property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
77 <message key="name.invalidPattern" value="Method names should start with a lower case letter (e.g. getWidth())"/>
79 <module name="ParameterName">
80 <property name="severity" value="error"/>
82 <module name="LocalFinalVariableName">
83 <property name="severity" value="error"/>
84 <property name="format" value="^m|s|((([ms][a-z0-9])|([a-ln-rt-z]))[a-zA-Z0-9]*)$"/>
85 <message key="name.invalidPattern" value="Local variables should be camel-cased (e.g. int minWidth = 4)."/>
87 <module name="LocalVariableName">
88 <property name="severity" value="error"/>
89 <property name="format" value="^m|s|((([ms][a-z0-9])|([a-ln-rt-z]))[a-zA-Z0-9]*)$"/>
90 <message key="name.invalidPattern" value="Local variables should be camel-cased (e.g. int minWidth = 4)."/>
92 <module name="LineLength">
93 <property name="severity" value="error"/>
94 <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
95 <property name="max" value="100"/>
97 <module name="LeftCurly">
98 <property name="severity" value="error"/>
100 <module name="RightCurly">
101 <property name="severity" value="error"/>
103 <module name="NeedBraces">
104 <property name="severity" value="info"/>
105 <property name="tokens" value="LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
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.$"/>