checkstyle.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 whether files end with a new line. -->
  39. <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
  40. <!-- module name="NewlineAtEndOfFile"/-->
  41. <!-- Checks that property files contain the same keys. -->
  42. <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
  43. <module name="Translation"/>
  44. <module name="FileLength"/>
  45. <module name="FileTabCharacter">
  46. <property name="eachLine" value="true"/>
  47. </module>
  48. <module name="TreeWalker">
  49. <property name="cacheFile" value="${checkstyle.cache.file}"/>
  50. <!-- Checks for Naming Conventions. -->
  51. <!-- See http://checkstyle.sf.net/config_naming.html -->
  52. <module name="ConstantName">
  53. <property name="format" value="^([A-Z_][A-Z0-9]*(_[A-Z0-9]+)*|_log)$"/>
  54. </module>
  55. <module name="LocalFinalVariableName"/>
  56. <module name="LocalVariableName"/>
  57. <module name="MemberName"/>
  58. <module name="MethodName"/>
  59. <module name="PackageName"/>
  60. <module name="ParameterName"/>
  61. <module name="StaticVariableName"/>
  62. <module name="TypeName"/>
  63. <!-- Checks for Headers -->
  64. <!-- See http://checkstyle.sf.net/config_header.html -->
  65. <!-- <module name="Header"> -->
  66. <!-- The follow property value demonstrates the ability -->
  67. <!-- to have access to ANT properties. In this case it uses -->
  68. <!-- the ${basedir} property to allow Checkstyle to be run -->
  69. <!-- from any directory within a project. See property -->
  70. <!-- expansion, -->
  71. <!-- http://checkstyle.sf.net/config.html#properties -->
  72. <!-- <property -->
  73. <!-- name="headerFile" -->
  74. <!-- value="${basedir}/java.header"/> -->
  75. <!-- </module> -->
  76. <!-- Following interprets the header file as regular expressions. -->
  77. <!-- <module name="RegexpHeader"/> -->
  78. <!-- Checks for imports -->
  79. <!-- See http://checkstyle.sf.net/config_import.html -->
  80. <!--module name="AvoidStarImport"/-->
  81. <module name="IllegalImport"/>
  82. <!-- defaults to sun.* packages -->
  83. <module name="RedundantImport"/>
  84. <module name="UnusedImports"/>
  85. <!-- Checks for Size Violations. -->
  86. <!-- See http://checkstyle.sf.net/config_sizes.html -->
  87. <module name="LineLength">
  88. <property name="max" value="110"/>
  89. </module>
  90. <module name="MethodLength"/>
  91. <module name="ParameterNumber">
  92. <property name="max" value="5"/>
  93. </module>
  94. <!-- Checks for whitespace -->
  95. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  96. <module name="EmptyForIteratorPad"/>
  97. <module name="MethodParamPad"/>
  98. <module name="NoWhitespaceAfter"/>
  99. <module name="NoWhitespaceBefore"/>
  100. <module name="OperatorWrap"/>
  101. <module name="ParenPad"/>
  102. <module name="TypecastParenPad"/>
  103. <module name="WhitespaceAfter"/>
  104. <!--module name="WhitespaceAround"/-->
  105. <!-- Modifier Checks -->
  106. <!-- See http://checkstyle.sf.net/config_modifiers.html -->
  107. <module name="ModifierOrder"/>
  108. <module name="RedundantModifier"/>
  109. <!-- Checks for blocks. You know, those {}'s -->
  110. <!-- See http://checkstyle.sf.net/config_blocks.html -->
  111. <module name="AvoidNestedBlocks">
  112. <property name="allowInSwitchCase" value="true"/>
  113. </module>
  114. <module name="EmptyBlock"/>
  115. <module name="LeftCurly"/>
  116. <module name="NeedBraces"/>
  117. <module name="RightCurly"/>
  118. <!-- Checks for common coding problems -->
  119. <!-- See http://checkstyle.sf.net/config_coding.html -->
  120. <!--module name="AvoidInlineConditionals"/-->
  121. <!-- MY FAVOURITE -->
  122. <module name="EmptyStatement"/>
  123. <module name="EqualsHashCode"/>
  124. <!--module name="HiddenField"/-->
  125. <module name="IllegalInstantiation"/>
  126. <module name="InnerAssignment"/>
  127. <!--module name="MagicNumber"/-->
  128. <module name="RedundantThrows">
  129. <property name="allowUnchecked" value="true"/>
  130. </module>
  131. <module name="SimplifyBooleanExpression"/>
  132. <module name="SimplifyBooleanReturn"/>
  133. <module name="StringLiteralEquality"/>
  134. <module name="NestedIfDepth"/>
  135. <module name="NestedTryDepth"/>
  136. <module name="SuperClone"/>
  137. <module name="IllegalCatch">
  138. <property name="illegalClassNames" value=" java.lang.Throwable, java.lang.RuntimeException"/>
  139. </module>
  140. <!--module name="IllegalThrows"/-->
  141. <module name="FallThrough"/>
  142. <module name="UnnecessaryParentheses"/>
  143. <!--module name="FinalLocalVariable"/-->
  144. <!-- Checks for class design -->
  145. <!-- See http://checkstyle.sf.net/config_design.html -->
  146. <!--module name="DesignForExtension"/-->
  147. <module name="FinalClass"/>
  148. <!--module name="HideUtilityClassConstructor"/-->
  149. <module name="InterfaceIsType"/>
  150. <module name="VisibilityModifier"/>
  151. <!-- Miscellaneous other checks. -->
  152. <!-- See http://checkstyle.sf.net/config_misc.html -->
  153. <module name="ArrayTypeStyle"/>
  154. <module name="Regexp">
  155. <property name="format" value="System\.(out)|(err)\.print(ln)?\("/>
  156. <property name="illegalPattern" value="true"/>
  157. </module>
  158. <module name="Regexp">
  159. <property name="format" value="System\.exit"/>
  160. <property name="illegalPattern" value="true"/>
  161. </module>
  162. <module name="Regexp">
  163. <property name="format" value="\.printStacktrace"/>
  164. <property name="illegalPattern" value="true"/>
  165. </module>
  166. <!--module name="FinalParameters"/-->
  167. <!--module name="GenericIllegalRegexp">
  168. <property name="format" value="\s+$"/>
  169. <property name="message" value="Line has trailing spaces."/>
  170. </module-->
  171. <!--module name="TodoComment"/-->
  172. <module name="UpperEll"/>
  173. </module>
  174. </module>