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 <!--
      5   See installation instructions: https://sites.google.com/a/chromium.org/dev/checkstyle
      6 -->
      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"/>
     13     </module>
     14     <module name="IllegalCatch">
     15       <property name="severity" value="warning"/>
     16     </module>
     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"/>
     20     </module>
     21     <module name="UnusedImports">
     22       <property name="severity" value="error"/>
     23       <property name="processJavadoc" value="true"/>
     24       <message key="import.unused" value="Unused import: {0}. Use :JavaImportOrganize (ECLIM) or Ctrl+Shift+O (Eclipse) to sort imports"/>
     25     </module>
     26     <module name="JavadocType">
     27       <property name="severity" value="error"/>
     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."/>
     31     </module>
     32     <module name="JavadocMethod">
     33       <property name="severity" value="warning"/>
     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"/>
     39     </module>
     40     <module name="PackageName">
     41       <property name="severity" value="error"/>
     42       <property name="format" value="^[a-z]+(\.[a-z][a-z0-9_]{1,})*$"/>
     43     </module>
     44     <module name="SimplifyBooleanExpression">
     45       <property name="severity" value="error"/>
     46     </module>
     47     <module name="SimplifyBooleanReturn">
     48       <property name="severity" value="error"/>
     49     </module>
     50     <module name="TypeName">
     51       <property name="severity" value="error"/>
     52     </module>
     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."/>
     57     </module>
     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."/>
     64     </module>
     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."/>
     71     </module>
     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())"/>
     76     </module>
     77     <module name="ParameterName">
     78       <property name="severity" value="error"/>
     79     </module>
     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)."/>
     84     </module>
     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)."/>
     89     </module>
     90     <module name="LineLength">
     91       <property name="severity" value="error"/>
     92       <property name="ignorePattern" value="^import.*$" />
     93       <property name="max" value="100"/>
     94     </module>
     95     <module name="LeftCurly">
     96       <property name="severity" value="error"/>
     97     </module>
     98     <module name="RightCurly">
     99       <property name="severity" value="error"/>
    100     </module>
    101     <module name="NeedBraces">
    102       <property name="severity" value="warning"/>
    103       <property name="tokens" value="LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
    104     </module>
    105     <module name="EmptyBlock">
    106       <property name="severity" value="error"/>
    107       <property name="option" value="text"/>
    108       <metadata name="altname" value="EmptyCatchBlock"/>
    109     </module>
    110     <module name="UpperEll">
    111       <property name="severity" value="error"/>
    112     </module>
    113     <module name="FallThrough">
    114       <property name="severity" value="error"/>
    115       <property name="reliefPattern" value=".*"/>
    116     </module>
    117     <module name="ModifierOrder">
    118       <property name="severity" value="error"/>
    119     </module>
    120     <module name="WhitespaceAround">
    121       <property name="severity" value="error"/>
    122       <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" />
    123       <property name="allowEmptyConstructors" value="true"/>
    124       <property name="allowEmptyMethods" value="true"/>
    125    </module>
    126     <module name="WhitespaceAfter">
    127       <property name="severity" value="error"/>
    128       <property name="tokens" value="COMMA, SEMI, TYPECAST"/>
    129     </module>
    130     <module name="NoWhitespaceAfter">
    131       <property name="severity" value="error"/>
    132       <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
    133     </module>
    134     <module name="NoWhitespaceBefore">
    135       <property name="severity" value="error"/>
    136       <property name="allowLineBreaks" value="true"/>
    137       <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
    138     </module>
    139     <module name="EmptyStatement">
    140       <property name="severity" value="error"/>
    141     </module>
    142     <module name="NoFinalizer">
    143       <property name="severity" value="warning"/>
    144     </module>
    145     <module name="ParenPad">
    146       <property name="severity" value="error"/>
    147     </module>
    148     <module name="ImportOrder">
    149       <property name="severity" value="error"/>
    150       <message key="import.ordering" value="Wrong order for {0} import. Use :JavaImportOrganize (ECLIM) or Ctrl+Shift+O (Eclipse) to sort imports"/>
    151       <property name="groups" value="android, com, dalvik, gov, junit, libcore, net, org, java, javax"/>
    152       <property name="ordered" value="true"/>
    153       <property name="option" value="top"/>
    154       <property name="separated" value="true"/>
    155     </module>
    156     <!-- TODO(aurimas): make indentation an error once https://github.com/checkstyle/checkstyle/issues/255 is fixed. -->
    157     <module name="Indentation">
    158       <property name="severity" value="warning"/>
    159       <property name="basicOffset" value="4"/>
    160       <property name="throwsIndent" value="8"/>
    161     </module>
    162   </module>
    163   <module name="FileTabCharacter">
    164     <property name="severity" value="error"/>
    165   </module>
    166   <module name="RegexpSingleline">
    167     <property name="format" value="((//.*)|(\*.*))FIXME"/>
    168     <property name="message" value="TODO is preferred to FIXME.  e.g. &quot;TODO(johndoe):"/>
    169   </module>
    170   <module name="RegexpSingleline">
    171     <property name="format" value="((//.*)|(\*.*))(?&lt;!TODO\(.{0,100})(TODO[^(])|(TODO\([^)]*$)"/>
    172     <property name="message" value="All TODOs should be named.  e.g. &quot;TODO(johndoe):"/>
    173   </module>
    174   <module name="RegexpSingleline">
    175     <property name="severity" value="error"/>
    176     <property name="format" value="[ \t]+$"/>
    177     <property name="message" value="Trailing whitespace"/>
    178     </module>
    179   <module name="RegexpHeader">
    180     <property name="severity" value="error"/>
    181     <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.$"/>
    182   </module>
    183 </module>
    184