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