checkstyle.xml 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?xml version="1.0"?>
  2. <!--
  3. /*
  4. * Copyright 2001-2004 The Apache Software Foundation.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. -->
  19. <!DOCTYPE module PUBLIC
  20. "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
  21. "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
  22. <!--
  23. Checkstyle configuration that checks the sun coding conventions from:
  24. - the Java Language Specification at
  25. http://java.sun.com/docs/books/jls/second_edition/html/index.html
  26. - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
  27. - the Javadoc guidelines at
  28. http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
  29. - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
  30. - some best practices
  31. Checkstyle is very configurable. Be sure to read the documentation at
  32. http://checkstyle.sf.net (or in your downloaded distribution).
  33. Most Checks are configurable, be sure to consult the documentation.
  34. To completely disable a check, just comment it out or delete it from the file.
  35. Finally, it is worth reading the documentation.
  36. -->
  37. <module name="Checker">
  38. <!-- Checks that a package.html file exists for each package. -->
  39. <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
  40. <module name="PackageHtml"/>
  41. <!-- Checks whether files end with a new line. -->
  42. <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
  43. <module name="NewlineAtEndOfFile"/>
  44. <!-- Checks that property files contain the same keys. -->
  45. <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
  46. <module name="Translation"/>
  47. <module name="TreeWalker">
  48. <property name="cacheFile" value="${checkstyle.cache.file}"/>
  49. <!-- Checks for Javadoc comments. -->
  50. <!-- See http://checkstyle.sf.net/config_javadoc.html -->
  51. <module name="JavadocMethod"/>
  52. <module name="JavadocType">
  53. <property name="scope" value="public"/>
  54. </module>
  55. <module name="JavadocVariable">
  56. <property name="scope" value="public"/>
  57. </module>
  58. <module name="JavadocStyle"/>
  59. <!-- Checks for Naming Conventions. -->
  60. <!-- See http://checkstyle.sf.net/config_naming.html -->
  61. <module name="ConstantName"/>
  62. <module name="LocalFinalVariableName"/>
  63. <module name="LocalVariableName"/>
  64. <module name="MemberName"/>
  65. <module name="MethodName"/>
  66. <module name="PackageName"/>
  67. <module name="ParameterName"/>
  68. <module name="StaticVariableName"/>
  69. <module name="TypeName"/>
  70. <!-- Checks for Headers -->
  71. <!-- See http://checkstyle.sf.net/config_header.html -->
  72. <!-- <module name="Header"> -->
  73. <!-- The follow property value demonstrates the ability -->
  74. <!-- to have access to ANT properties. In this case it uses -->
  75. <!-- the ${basedir} property to allow Checkstyle to be run -->
  76. <!-- from any directory within a project. See property -->
  77. <!-- expansion, -->
  78. <!-- http://checkstyle.sf.net/config.html#properties -->
  79. <!-- <property -->
  80. <!-- name="headerFile" -->
  81. <!-- value="${basedir}/java.header"/> -->
  82. <!-- </module> -->
  83. <!-- Following interprets the header file as regular expressions. -->
  84. <!-- <module name="RegexpHeader"/> -->
  85. <!-- Checks for imports -->
  86. <!-- See http://checkstyle.sf.net/config_import.html -->
  87. <module name="AvoidStarImport"/>
  88. <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
  89. <module name="RedundantImport"/>
  90. <module name="UnusedImports"/>
  91. <!-- Checks for Size Violations. -->
  92. <!-- See http://checkstyle.sf.net/config_sizes.html -->
  93. <module name="FileLength"/>
  94. <module name="LineLength">
  95. <property name="max" value="120"/>
  96. </module>
  97. <module name="MethodLength"/>
  98. <module name="ParameterNumber"/>
  99. <!-- Checks for whitespace -->
  100. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  101. <module name="EmptyForIteratorPad"/>
  102. <module name="MethodParamPad"/>
  103. <module name="NoWhitespaceAfter">
  104. <!-- Default tokens and additional GENERIC_START -->
  105. <property name="tokens" value="ARRAY_INIT, BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS, GENERIC_START"/>
  106. </module>
  107. <module name="NoWhitespaceBefore">
  108. <!-- Default tokens and additional GENERIC_START and GENERIC_END -->
  109. <property name="tokens" value="SEMI, POST_DEC, POST_INC, GENERIC_START, GENERIC_END"/>
  110. </module>
  111. <module name="WhitespaceAfter">
  112. <!-- Default tokens and additional GENERIC_END -->
  113. <property name="tokens" value="COMMA, SEMI, TYPECAST, GENERIC_END"/>
  114. </module>
  115. <module name="WhitespaceAround">
  116. <!-- Default tokens without GENERIC_START and GENERIC_END -->
  117. <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN,
  118. BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON,
  119. DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE,
  120. LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
  121. LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
  122. LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
  123. MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN,
  124. QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,
  125. TYPE_EXTENSION_AND, WILDCARD_TYPE"/>
  126. </module>
  127. <module name="OperatorWrap"/>
  128. <module name="ParenPad"/>
  129. <module name="TypecastParenPad"/>
  130. <module name="TabCharacter"/>
  131. <!-- Modifier Checks -->
  132. <!-- See http://checkstyle.sf.net/config_modifiers.html -->
  133. <module name="ModifierOrder"/>
  134. <module name="RedundantModifier"/>
  135. <!-- Checks for blocks. You know, those {}'s -->
  136. <!-- See http://checkstyle.sf.net/config_blocks.html -->
  137. <module name="AvoidNestedBlocks"/>
  138. <module name="EmptyBlock"/>
  139. <module name="LeftCurly"/>
  140. <module name="NeedBraces"/>
  141. <module name="RightCurly"/>
  142. <!-- Checks for common coding problems -->
  143. <!-- See http://checkstyle.sf.net/config_coding.html -->
  144. <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
  145. <module name="EmptyStatement"/>
  146. <module name="EqualsHashCode"/>
  147. <module name="IllegalInstantiation"/>
  148. <module name="InnerAssignment"/>
  149. <module name="MagicNumber"/>
  150. <module name="MissingSwitchDefault"/>
  151. <module name="RedundantThrows"/>
  152. <module name="SimplifyBooleanExpression"/>
  153. <module name="SimplifyBooleanReturn"/>
  154. <!-- Checks for class design -->
  155. <!-- See http://checkstyle.sf.net/config_design.html -->
  156. <module name="DesignForExtension"/>
  157. <module name="FinalClass"/>
  158. <module name="HideUtilityClassConstructor"/>
  159. <module name="InterfaceIsType"/>
  160. <module name="VisibilityModifier"/>
  161. <!-- Miscellaneous other checks. -->
  162. <!-- See http://checkstyle.sf.net/config_misc.html -->
  163. <module name="ArrayTypeStyle"/>
  164. <module name="FinalParameters"/>
  165. <module name="GenericIllegalRegexp">
  166. <property name="format" value="\s+$"/>
  167. <property name="message" value="Line has trailing spaces."/>
  168. </module>
  169. <module name="TodoComment"/>
  170. <module name="UpperEll"/>
  171. </module>
  172. </module>