Home | History | Annotate | Download | only in checkstyle
      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">
      3 
      4 <module name="Checker">
      5   <property name="severity" value="warning"/>
      6   <property name="charset" value="UTF-8"/>
      7   <module name="SuppressionCommentFilter">
      8     <property name="offCommentFormat" value="CHECKSTYLE:OFF IndentationCheck"/>
      9     <property name="onCommentFormat" value="CHECKSTYLE:ON IndentationCheck"/>
     10     <property name="checkFormat" value="IndentationCheck"/>
     11   </module>
     12   <module name="TreeWalker">
     13     <module name="AvoidStarImport">
     14       <property name="severity" value="error"/>
     15       <property name="excludes" value="org.junit.Assert,org.mockito.Mockito,org.hamcrest.Matchers"/>
     16     </module>
     17     <module name="IllegalCatch">
     18       <property name="severity" value="info"/>
     19     </module>
     20     <module name="RedundantImport">
     21       <message key="import.redundant" value="Redundant import: {0}. Use Ctrl+Shift+O (Eclipse) or Ctrl+Alt+O (Intellij) to sort imports"/>
     22       <property name="severity" value="error"/>
     23     </module>
     24     <module name="UnusedImports">
     25       <message key="import.unused" value="Unused import: {0}. Use Ctrl+Shift+O (Eclipse) or Ctrl+Alt+O (Intellij) to sort imports"/>
     26       <property name="severity" value="error"/>
     27       <property name="processJavadoc" value="true"/>
     28     </module>
     29     <module name="JavadocType">
     30       <property name="severity" value="warning"/>
     31       <property name="tokens" value="INTERFACE_DEF, CLASS_DEF"/>
     32       <property name="scope" value="public"/>
     33       <property name="allowUnknownTags" value="true"/> <!-- Allows @hide tags in JavaDocs -->
     34       <message key="javadoc.missing" value="Public classes and interfaces require JavaDoc comments."/>
     35     </module>
     36     <module name="JavadocMethod">
     37       <property name="severity" value="error"/>
     38       <property name="scope" value="public"/>
     39       <property name="tokens" value="METHOD_DEF"/>
     40       <property name="allowMissingParamTags" value="true"/>
     41       <property name="allowMissingPropertyJavadoc" value="true"/>
     42       <property name="allowMissingReturnTag" value="true"/>
     43       <property name="allowMissingThrowsTags" value="true"/>
     44     </module>
     45     <module name="PackageName">
     46       <property name="severity" value="error"/>
     47       <property name="format" value="^[a-z]+(\.[a-z][a-z0-9_]{1,})*$"/>
     48     </module>
     49     <module name="SimplifyBooleanExpression">
     50       <property name="severity" value="error"/>
     51     </module>
     52     <module name="SimplifyBooleanReturn">
     53       <property name="severity" value="error"/>
     54     </module>
     55     <module name="TypeName">
     56       <property name="severity" value="error"/>
     57     </module>
     58     <module name="ConstantName">
     59       <property name="severity" value="error"/>
     60       <property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)|(s[A-Z][a-zA-Z0-9]*)$"/>
     61       <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."/>
     62     </module>
     63     <!-- Non-public, non-static field names start with m. -->
     64     <module name="MemberName">
     65         <property name="severity" value="error"/>
     66         <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
     67         <property name="applyToPublic" value="false"/>
     68         <message key="name.invalidPattern" value="Non-public, non-static field names start with m."/>
     69     </module>
     70     <!-- Static field names start with s. -->
     71     <module name="StaticVariableName">
     72         <property name="severity" value="error"/>
     73         <property name="format" value="^s[A-Z][a-zA-Z0-9]*$"/>
     74         <property name="applyToPublic" value="false"/>
     75         <message key="name.invalidPattern" value="Static field names start with s."/>
     76     </module>
     77     <module name="MethodName">
     78         <property name="severity" value="error"/>
     79         <property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
     80         <message key="name.invalidPattern" value="Method names should start with a lower case letter (e.g. getWidth())"/>
     81     </module>
     82     <module name="ParameterName">
     83       <property name="severity" value="error"/>
     84     </module>
     85     <module name="LocalFinalVariableName">
     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)."/>
     89     </module>
     90     <module name="LocalVariableName">
     91       <property name="severity" value="error"/>
     92       <property name="format" value="^m|s|((([ms][a-z0-9])|([a-ln-rt-z]))[a-zA-Z0-9]*)$"/>
     93       <message key="name.invalidPattern" value="Local variables should be camel-cased (e.g. int minWidth = 4)."/>
     94     </module>
     95     <module name="LineLength">
     96       <property name="severity" value="error"/>
     97       <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
     98       <property name="max" value="100"/>
     99     </module>
    100     <module name="LeftCurly">
    101       <property name="severity" value="error"/>
    102     </module>
    103     <module name="RightCurly">
    104       <property name="severity" value="error"/>
    105     </module>
    106     <module name="NeedBraces">
    107       <message key="needBraces" value="if, for, while, and do require curly braces unless they are single-line statements."/>
    108       <property name="severity" value="error"/>
    109       <property name="tokens" value="LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, LITERAL_IF"/>
    110       <property name="allowSingleLineStatement" value="true"/>
    111     </module>
    112     <module name="EmptyBlock">
    113       <property name="severity" value="error"/>
    114       <property name="option" value="text"/>
    115       <metadata name="altname" value="EmptyCatchBlock"/>
    116     </module>
    117     <module name="UpperEll">
    118       <property name="severity" value="error"/>
    119     </module>
    120     <module name="FallThrough">
    121       <property name="severity" value="error"/>
    122       <property name="reliefPattern" value=".*"/>
    123     </module>
    124     <module name="ModifierOrder">
    125       <property name="severity" value="error"/>
    126     </module>
    127     <module name="WhitespaceAround">
    128       <property name="severity" value="error"/>
    129       <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" />
    130       <property name="allowEmptyConstructors" value="true"/>
    131       <property name="allowEmptyMethods" value="true"/>
    132    </module>
    133     <module name="WhitespaceAfter">
    134       <property name="severity" value="error"/>
    135       <property name="tokens" value="COMMA, SEMI, TYPECAST"/>
    136     </module>
    137     <module name="NoWhitespaceAfter">
    138       <property name="severity" value="error"/>
    139       <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
    140     </module>
    141     <module name="NoWhitespaceBefore">
    142       <property name="severity" value="error"/>
    143       <property name="allowLineBreaks" value="true"/>
    144       <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
    145     </module>
    146     <module name="GenericWhitespace">
    147       <property name="severity" value="error"/>
    148       <message key="ws.followed"
    149        value="GenericWhitespace ''{0}'' is followed by whitespace."/>
    150        <message key="ws.preceded"
    151        value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
    152        <message key="ws.illegalFollow"
    153        value="GenericWhitespace ''{0}'' should followed by whitespace."/>
    154        <message key="ws.notPreceded"
    155        value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
    156     </module>
    157     <module name="EmptyStatement">
    158       <property name="severity" value="error"/>
    159     </module>
    160     <module name="NoFinalizer">
    161       <property name="severity" value="info"/>
    162     </module>
    163     <module name="ParenPad">
    164       <property name="severity" value="error"/>
    165     </module>
    166     <module name="MethodParamPad">
    167       <property name="severity" value="error"/>
    168     </module>
    169     <module name="ImportOrder">
    170       <property name="severity" value="error"/>
    171       <message key="import.ordering" value="Wrong order for {0} import. Use Ctrl+Shift+O (Eclipse) or Ctrl+Alt+O (Intellij) to sort imports"/>
    172       <property name="groups" value="android, com.android, dalvik, com, gov, junit, libcore, net, org, java, javax"/>
    173       <property name="ordered" value="true"/>
    174       <property name="option" value="top"/>
    175       <property name="separated" value="true"/>
    176     </module>
    177     <module name="Indentation">
    178       <property name="severity" value="error"/>
    179       <property name="basicOffset" value="4"/>
    180       <property name="throwsIndent" value="8"/>
    181       <property name="lineWrappingIndentation" value="8"/>
    182     </module>
    183     <module name="OperatorWrap">
    184       <property name="severity" value="error"/>
    185       <property name="option" value="NL" />
    186       <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 " />
    187     </module>
    188     <module name="OperatorWrap">
    189      <property name="severity" value="error"/>
    190      <property name="option" value="eol"/>
    191      <property name="tokens" value="ASSIGN"/>
    192     </module>
    193     <module name="SeparatorWrap">
    194       <property name="severity" value="error"/>
    195       <property name="tokens" value="DOT"/>
    196       <property name="option" value="nl"/>
    197     </module>
    198     <module name="SeparatorWrap">
    199       <property name="severity" value="error"/>
    200       <property name="tokens" value="COMMA"/>
    201       <property name="option" value="EOL"/>
    202     </module>
    203     <module name="MissingDeprecated">
    204       <property name="severity" value="error"/>
    205     </module>
    206     <module name="MissingOverride">
    207       <property name="severity" value="error"/>
    208     </module>
    209     <module name="OneTopLevelClass">
    210       <property name="severity" value="error"/>
    211     </module>
    212     <module name="StringLiteralEquality">
    213       <property name="severity" value="error"/>
    214     </module>
    215     <module name="ArrayTypeStyle">
    216       <property name="severity" value="error"/>
    217     </module>
    218     <module name="RedundantModifier">
    219       <property name="severity" value="error"/>
    220     </module>
    221     <module name="OuterTypeFilename">
    222       <property name="severity" value="error"/>
    223     </module>
    224     <module name="FileContentsHolder"/>
    225   </module>
    226   <module name="FileTabCharacter">
    227     <property name="severity" value="error"/>
    228   </module>
    229   <module name="NewlineAtEndOfFile">
    230     <property name="severity" value="error"/>
    231   </module>
    232   <module name="RegexpSingleline">
    233     <property name="severity" value="error"/>
    234     <property name="format" value="[ \t]+$"/>
    235     <property name="message" value="Trailing whitespace"/>
    236   </module>
    237   <module name="RegexpHeader">
    238     <property name="severity" value="error"/>
    239     <message key="header.mismatch"
    240              value="Android Copyright header seems to be incorrect. Expected ''{0}'' on this line."/>
    241     <property name="header" value="^/\*\n \* Copyright \([Cc]\) [0-9]{4} The Android Open Source Project\n \*\n \* Licensed under the Apache License, Version 2\.0 \(the \&quot;License\&quot;\);\n \* you may not use this file except in compliance with the License.\n \* You may obtain a copy of the License at\n \*\n \*      http:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0\n \*\n \* Unless required by applicable law or agreed to in writing, software\n \* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,\n \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.\n \* See the License for the specific language governing permissions and\n \* limitations under the License\.\n \*\/" />
    242   </module>
    243 </module>
    244