google_checks_7.1.2.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?xml version="1.0"?>
  2. <!DOCTYPE module PUBLIC
  3. "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
  4. "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
  5. <!--
  6. Checkstyle configuration that checks the Google coding conventions from Google Java Style
  7. that can be found at https://google.github.io/styleguide/javaguide.html.
  8. Checkstyle is very configurable. Be sure to read the documentation at
  9. http://checkstyle.sf.net (or in your downloaded distribution).
  10. To completely disable a check, just comment it out or delete it from the file.
  11. Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
  12. -->
  13. <module name="Checker">
  14. <property name="charset" value="UTF-8"/>
  15. <property name="severity" value="warning"/>
  16. <property name="fileExtensions" value="java, properties, xml"/>
  17. <!-- Checks for whitespace -->
  18. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  19. <module name="FileTabCharacter">
  20. <property name="eachLine" value="true"/>
  21. </module>
  22. <module name="TreeWalker">
  23. <module name="OuterTypeFilename"/>
  24. <module name="IllegalTokenText">
  25. <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
  26. <property name="format"
  27. value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
  28. <property name="message" value="Avoid using corresponding octal or Unicode escape."/>
  29. </module>
  30. <module name="AvoidEscapedUnicodeCharacters">
  31. <property name="allowEscapesForControlCharacters" value="true"/>
  32. <property name="allowByTailComment" value="true"/>
  33. <property name="allowNonPrintableEscapes" value="true"/>
  34. </module>
  35. <module name="LineLength">
  36. <property name="max" value="100"/>
  37. <property name="ignorePattern"
  38. value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
  39. </module>
  40. <module name="AvoidStarImport"/>
  41. <module name="OneTopLevelClass"/>
  42. <module name="NoLineWrap"/>
  43. <module name="EmptyBlock">
  44. <property name="option" value="TEXT"/>
  45. <property name="tokens"
  46. value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
  47. </module>
  48. <module name="NeedBraces"/>
  49. <module name="LeftCurly">
  50. <property name="maxLineLength" value="100"/>
  51. </module>
  52. <module name="RightCurly"/>
  53. <module name="RightCurly">
  54. <property name="option" value="alone"/>
  55. <property name="tokens"
  56. value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
  57. </module>
  58. <module name="WhitespaceAround">
  59. <property name="allowEmptyConstructors" value="true"/>
  60. <property name="allowEmptyMethods" value="true"/>
  61. <property name="allowEmptyTypes" value="true"/>
  62. <property name="allowEmptyLoops" value="true"/>
  63. <message key="ws.notFollowed"
  64. value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
  65. <message key="ws.notPreceded"
  66. value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
  67. </module>
  68. <module name="OneStatementPerLine"/>
  69. <module name="MultipleVariableDeclarations"/>
  70. <module name="ArrayTypeStyle"/>
  71. <module name="MissingSwitchDefault"/>
  72. <module name="FallThrough"/>
  73. <module name="UpperEll"/>
  74. <module name="ModifierOrder"/>
  75. <module name="EmptyLineSeparator">
  76. <property name="allowNoEmptyLineBetweenFields" value="true"/>
  77. </module>
  78. <module name="SeparatorWrap">
  79. <property name="tokens" value="DOT"/>
  80. <property name="option" value="nl"/>
  81. </module>
  82. <module name="SeparatorWrap">
  83. <property name="tokens" value="COMMA"/>
  84. <property name="option" value="EOL"/>
  85. </module>
  86. <module name="PackageName">
  87. <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
  88. <message key="name.invalidPattern"
  89. value="Package name ''{0}'' must match pattern ''{1}''."/>
  90. </module>
  91. <module name="TypeName">
  92. <message key="name.invalidPattern"
  93. value="Type name ''{0}'' must match pattern ''{1}''."/>
  94. </module>
  95. <module name="MemberName">
  96. <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
  97. <message key="name.invalidPattern"
  98. value="Member name ''{0}'' must match pattern ''{1}''."/>
  99. </module>
  100. <module name="ParameterName">
  101. <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
  102. <message key="name.invalidPattern"
  103. value="Parameter name ''{0}'' must match pattern ''{1}''."/>
  104. </module>
  105. <module name="CatchParameterName">
  106. <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
  107. <message key="name.invalidPattern"
  108. value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
  109. </module>
  110. <module name="LocalVariableName">
  111. <property name="tokens" value="VARIABLE_DEF"/>
  112. <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
  113. <property name="allowOneCharVarInForLoop" value="true"/>
  114. <message key="name.invalidPattern"
  115. value="Local variable name ''{0}'' must match pattern ''{1}''."/>
  116. </module>
  117. <module name="ClassTypeParameterName">
  118. <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
  119. <message key="name.invalidPattern"
  120. value="Class type name ''{0}'' must match pattern ''{1}''."/>
  121. </module>
  122. <module name="MethodTypeParameterName">
  123. <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
  124. <message key="name.invalidPattern"
  125. value="Method type name ''{0}'' must match pattern ''{1}''."/>
  126. </module>
  127. <module name="InterfaceTypeParameterName">
  128. <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
  129. <message key="name.invalidPattern"
  130. value="Interface type name ''{0}'' must match pattern ''{1}''."/>
  131. </module>
  132. <module name="NoFinalizer"/>
  133. <module name="GenericWhitespace">
  134. <message key="ws.followed"
  135. value="GenericWhitespace ''{0}'' is followed by whitespace."/>
  136. <message key="ws.preceded"
  137. value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
  138. <message key="ws.illegalFollow"
  139. value="GenericWhitespace ''{0}'' should followed by whitespace."/>
  140. <message key="ws.notPreceded"
  141. value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
  142. </module>
  143. <module name="Indentation">
  144. <property name="basicOffset" value="2"/>
  145. <property name="braceAdjustment" value="0"/>
  146. <property name="caseIndent" value="2"/>
  147. <property name="throwsIndent" value="4"/>
  148. <property name="lineWrappingIndentation" value="4"/>
  149. <property name="arrayInitIndent" value="2"/>
  150. </module>
  151. <module name="AbbreviationAsWordInName">
  152. <property name="ignoreFinal" value="false"/>
  153. <property name="allowedAbbreviationLength" value="1"/>
  154. </module>
  155. <module name="OverloadMethodsDeclarationOrder"/>
  156. <module name="VariableDeclarationUsageDistance"/>
  157. <module name="CustomImportOrder">
  158. <property name="specialImportsRegExp" value="com.google"/>
  159. <property name="sortImportsInGroupAlphabetically" value="true"/>
  160. <property name="customImportOrderRules"
  161. value="STATIC###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE"/>
  162. </module>
  163. <module name="MethodParamPad"/>
  164. <module name="OperatorWrap">
  165. <property name="option" value="NL"/>
  166. <property name="tokens"
  167. value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
  168. </module>
  169. <module name="AnnotationLocation">
  170. <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
  171. </module>
  172. <module name="AnnotationLocation">
  173. <property name="tokens" value="VARIABLE_DEF"/>
  174. <property name="allowSamelineMultipleAnnotations" value="true"/>
  175. </module>
  176. <module name="NonEmptyAtclauseDescription"/>
  177. <module name="JavadocTagContinuationIndentation"/>
  178. <module name="SummaryJavadoc">
  179. <property name="forbiddenSummaryFragments"
  180. value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
  181. </module>
  182. <module name="JavadocParagraph"/>
  183. <module name="AtclauseOrder">
  184. <property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
  185. <property name="target"
  186. value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
  187. </module>
  188. <module name="JavadocMethod">
  189. <property name="scope" value="public"/>
  190. <property name="allowMissingParamTags" value="true"/>
  191. <property name="allowMissingThrowsTags" value="true"/>
  192. <property name="allowMissingReturnTag" value="true"/>
  193. <property name="minLineCount" value="2"/>
  194. <property name="allowedAnnotations" value="Override, Test"/>
  195. <property name="allowThrowsTagsForSubclasses" value="true"/>
  196. </module>
  197. <module name="MethodName">
  198. <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
  199. <message key="name.invalidPattern"
  200. value="Method name ''{0}'' must match pattern ''{1}''."/>
  201. </module>
  202. <module name="SingleLineJavadoc">
  203. <property name="ignoreInlineTags" value="false"/>
  204. </module>
  205. <module name="EmptyCatchBlock">
  206. <property name="exceptionVariableName" value="expected"/>
  207. </module>
  208. <module name="CommentsIndentation"/>
  209. </module>
  210. </module>