Mirror of retrofit, Type-safe HTTP client for Android and Java by Square, Inc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

checkstyle.xml 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <?xml version="1.0"?>
  2. <!DOCTYPE module PUBLIC
  3. "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
  4. "https://checkstyle.org/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. <!-- Excludes all 'module-info.java' files -->
  18. <!-- See https://checkstyle.org/config_filefilters.html -->
  19. <module name="BeforeExecutionExclusionFileFilter">
  20. <property name="fileNamePattern" value="module\-info\.java$"/>
  21. </module>
  22. <!-- Checks for whitespace -->
  23. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  24. <module name="FileTabCharacter">
  25. <property name="eachLine" value="true"/>
  26. </module>
  27. <module name="LineLength">
  28. <property name="fileExtensions" value="java"/>
  29. <property name="max" value="100"/>
  30. <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
  31. </module>
  32. <module name="TreeWalker">
  33. <module name="OuterTypeFilename"/>
  34. <module name="IllegalTokenText">
  35. <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
  36. <property name="format"
  37. value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
  38. <property name="message"
  39. value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
  40. </module>
  41. <module name="AvoidEscapedUnicodeCharacters">
  42. <property name="allowEscapesForControlCharacters" value="true"/>
  43. <property name="allowByTailComment" value="true"/>
  44. <property name="allowNonPrintableEscapes" value="true"/>
  45. </module>
  46. <module name="AvoidStarImport"/>
  47. <module name="OneTopLevelClass"/>
  48. <module name="NoLineWrap"/>
  49. <module name="EmptyBlock">
  50. <property name="option" value="TEXT"/>
  51. <property name="tokens"
  52. value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
  53. </module>
  54. <module name="NeedBraces"/>
  55. <module name="LeftCurly"/>
  56. <module name="RightCurly">
  57. <property name="id" value="RightCurlySame"/>
  58. <property name="tokens"
  59. value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
  60. LITERAL_DO"/>
  61. </module>
  62. <module name="RightCurly">
  63. <property name="id" value="RightCurlyAlone"/>
  64. <property name="option" value="alone"/>
  65. <property name="tokens"
  66. value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
  67. INSTANCE_INIT"/>
  68. </module>
  69. <module name="WhitespaceAround">
  70. <property name="allowEmptyConstructors" value="true"/>
  71. <property name="allowEmptyLambdas" value="true"/>
  72. <property name="allowEmptyMethods" value="true"/>
  73. <property name="allowEmptyTypes" value="true"/>
  74. <property name="allowEmptyLoops" value="true"/>
  75. <message key="ws.notFollowed"
  76. 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)"/>
  77. <message key="ws.notPreceded"
  78. value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
  79. </module>
  80. <module name="OneStatementPerLine"/>
  81. <module name="MultipleVariableDeclarations"/>
  82. <module name="ArrayTypeStyle"/>
  83. <module name="MissingSwitchDefault"/>
  84. <module name="FallThrough"/>
  85. <module name="UpperEll"/>
  86. <module name="ModifierOrder"/>
  87. <module name="EmptyLineSeparator">
  88. <property name="allowNoEmptyLineBetweenFields" value="true"/>
  89. </module>
  90. <module name="SeparatorWrap">
  91. <property name="id" value="SeparatorWrapDot"/>
  92. <property name="tokens" value="DOT"/>
  93. <property name="option" value="nl"/>
  94. </module>
  95. <module name="SeparatorWrap">
  96. <property name="id" value="SeparatorWrapComma"/>
  97. <property name="tokens" value="COMMA"/>
  98. <property name="option" value="EOL"/>
  99. </module>
  100. <module name="SeparatorWrap">
  101. <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
  102. <property name="id" value="SeparatorWrapEllipsis"/>
  103. <property name="tokens" value="ELLIPSIS"/>
  104. <property name="option" value="EOL"/>
  105. </module>
  106. <module name="SeparatorWrap">
  107. <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
  108. <property name="id" value="SeparatorWrapArrayDeclarator"/>
  109. <property name="tokens" value="ARRAY_DECLARATOR"/>
  110. <property name="option" value="EOL"/>
  111. </module>
  112. <module name="SeparatorWrap">
  113. <property name="id" value="SeparatorWrapMethodRef"/>
  114. <property name="tokens" value="METHOD_REF"/>
  115. <property name="option" value="nl"/>
  116. </module>
  117. <module name="PackageName">
  118. <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
  119. <message key="name.invalidPattern"
  120. value="Package name ''{0}'' must match pattern ''{1}''."/>
  121. </module>
  122. <module name="TypeName">
  123. <message key="name.invalidPattern"
  124. value="Type name ''{0}'' must match pattern ''{1}''."/>
  125. </module>
  126. <module name="MemberName">
  127. <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
  128. <message key="name.invalidPattern"
  129. value="Member name ''{0}'' must match pattern ''{1}''."/>
  130. </module>
  131. <module name="ParameterName">
  132. <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
  133. <message key="name.invalidPattern"
  134. value="Parameter name ''{0}'' must match pattern ''{1}''."/>
  135. </module>
  136. <module name="LambdaParameterName">
  137. <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
  138. <message key="name.invalidPattern"
  139. value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
  140. </module>
  141. <module name="CatchParameterName">
  142. <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
  143. <message key="name.invalidPattern"
  144. value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
  145. </module>
  146. <module name="LocalVariableName">
  147. <property name="tokens" value="VARIABLE_DEF"/>
  148. <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
  149. <message key="name.invalidPattern"
  150. value="Local variable name ''{0}'' must match pattern ''{1}''."/>
  151. </module>
  152. <module name="ClassTypeParameterName">
  153. <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
  154. <message key="name.invalidPattern"
  155. value="Class type name ''{0}'' must match pattern ''{1}''."/>
  156. </module>
  157. <module name="MethodTypeParameterName">
  158. <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
  159. <message key="name.invalidPattern"
  160. value="Method type name ''{0}'' must match pattern ''{1}''."/>
  161. </module>
  162. <module name="InterfaceTypeParameterName">
  163. <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
  164. <message key="name.invalidPattern"
  165. value="Interface type name ''{0}'' must match pattern ''{1}''."/>
  166. </module>
  167. <module name="NoFinalizer"/>
  168. <module name="GenericWhitespace">
  169. <message key="ws.followed"
  170. value="GenericWhitespace ''{0}'' is followed by whitespace."/>
  171. <message key="ws.preceded"
  172. value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
  173. <message key="ws.illegalFollow"
  174. value="GenericWhitespace ''{0}'' should followed by whitespace."/>
  175. <message key="ws.notPreceded"
  176. value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
  177. </module>
  178. <module name="Indentation">
  179. <property name="basicOffset" value="2"/>
  180. <property name="braceAdjustment" value="0"/>
  181. <property name="caseIndent" value="2"/>
  182. <property name="throwsIndent" value="4"/>
  183. <property name="lineWrappingIndentation" value="4"/>
  184. <property name="arrayInitIndent" value="2"/>
  185. </module>
  186. <module name="AbbreviationAsWordInName">
  187. <property name="ignoreFinal" value="false"/>
  188. <property name="allowedAbbreviationLength" value="1"/>
  189. </module>
  190. <module name="OverloadMethodsDeclarationOrder"/>
  191. <module name="VariableDeclarationUsageDistance"/>
  192. <module name="CustomImportOrder">
  193. <property name="sortImportsInGroupAlphabetically" value="true"/>
  194. <property name="separateLineBetweenGroups" value="true"/>
  195. <property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
  196. </module>
  197. <module name="MethodParamPad"/>
  198. <module name="NoWhitespaceBefore">
  199. <property name="tokens"
  200. value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
  201. <property name="allowLineBreaks" value="true"/>
  202. </module>
  203. <module name="ParenPad"/>
  204. <module name="OperatorWrap">
  205. <property name="option" value="NL"/>
  206. <property name="tokens"
  207. value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
  208. LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
  209. </module>
  210. <module name="AnnotationLocation">
  211. <property name="id" value="AnnotationLocationMostCases"/>
  212. <property name="tokens"
  213. value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
  214. </module>
  215. <module name="AnnotationLocation">
  216. <property name="id" value="AnnotationLocationVariables"/>
  217. <property name="tokens" value="VARIABLE_DEF"/>
  218. <property name="allowSamelineMultipleAnnotations" value="true"/>
  219. </module>
  220. <module name="NonEmptyAtclauseDescription"/>
  221. <module name="InvalidJavadocPosition"/>
  222. <module name="JavadocTagContinuationIndentation"/>
  223. <module name="SummaryJavadoc">
  224. <property name="forbiddenSummaryFragments"
  225. value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
  226. </module>
  227. <module name="JavadocParagraph"/>
  228. <module name="AtclauseOrder">
  229. <property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
  230. <property name="target"
  231. value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
  232. </module>
  233. <module name="JavadocMethod">
  234. <property name="scope" value="public"/>
  235. <property name="allowMissingParamTags" value="true"/>
  236. <property name="allowMissingThrowsTags" value="true"/>
  237. <property name="allowMissingReturnTag" value="true"/>
  238. <property name="allowedAnnotations" value="Override, Test"/>
  239. <property name="allowThrowsTagsForSubclasses" value="true"/>
  240. </module>
  241. <module name="MissingJavadocMethod">
  242. <property name="scope" value="public"/>
  243. <property name="minLineCount" value="2"/>
  244. <property name="allowedAnnotations" value="Override, Test"/>
  245. </module>
  246. <module name="MethodName">
  247. <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
  248. <message key="name.invalidPattern"
  249. value="Method name ''{0}'' must match pattern ''{1}''."/>
  250. </module>
  251. <module name="SingleLineJavadoc">
  252. <property name="ignoreInlineTags" value="false"/>
  253. </module>
  254. <module name="EmptyCatchBlock">
  255. <property name="exceptionVariableName" value="expected"/>
  256. </module>
  257. <module name="CommentsIndentation"/>
  258. </module>
  259. </module>