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.

vaadin-checkstyle.xml 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. <!-- Checkstyle configuration for Vaadin that is based on the the sun coding
  6. conventions from:
  7. - the Java Language Specification at http://java.sun.com/docs/books/jls/second_edition/html/index.html
  8. - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
  9. - the Javadoc guidelines at http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
  10. - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
  11. - some best practices Vaadin specific changes:
  12. - Removed DoubleCheckedLocking because it doesn't work in CheckStyle 5.6
  13. -> http://www.smartics.eu/bugzilla/show_bug.cgi?id=593
  14. - Modified HiddenField Check to allow field shadowing on Constructor, Setter
  15. and Abstract Method parameters.
  16. - Modified StaticVariableName Check format for PUBLIC variables from ^[a-z][a-zA-Z0-9]*$
  17. to ^[A-Z_]*$ . Others (protected, package and private) still have ^[a-z][a-zA-Z0-9]*$
  18. - Modified the severity of the following Checks from error to info:
  19. • JavadocPackage (checks for package-info.java)
  20. • JavadocType (class and interface declarations, scope private)
  21. • JavadocMethod (method declarations, scope private)
  22. • JavadocVariable (variable declarations, scope private)
  23. • JavadocStyle (Javadocs are "well formed")
  24. - Modified the severity of the following Checks from error to warning because
  25. not so critical:
  26. • LineLenght (the default value is 80 which is also used in formatter, but
  27. i.e. member declarations are not wrapped onto next line)
  28. • RedundantModifier (i.e. using public in interface method declarations)
  29. • RedundantThrows (causes unnecessary fails when can't get class information)
  30. • MethodLength (default maxLength is 150)
  31. • ParameterNumber (default maxLength is 7)
  32. • EmptyBlock (if-else statements have some blocks if x -> no action)
  33. • UpperEll (should use L instead of l with long)
  34. • TodoComment (not serious)
  35. • WhitespaceAroundCheck (expects whitespace around some operators)
  36. NOTE other checks are also warning but should be error.
  37. - Modified the severity of the following Checks from error to ignore:
  38. • FinalParameters (method parameters can be modified)
  39. • VisibilityModifier (i.e. in state classes public members are allowed)
  40. • DesignForExtension (this design is not used)
  41. • FileLength (bad design to have files with over 2000 lines? see VScrollTable)
  42. • MagicNumber (MagicNumbers like error codes are used, but could just ignore
  43. this in some classes)
  44. • AvoidInlineConditionals ( you like these ? ignore : error ) -->
  45. <module name="Checker">
  46. <!-- If you set the basedir property below, then all reported file names
  47. will be relative to the specified directory. See http://checkstyle.sourceforge.net/5.x/config.html#Checker
  48. <property name="basedir" value="${basedir}"/> -->
  49. <!-- Checks that a package-info.java file exists for each package. -->
  50. <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
  51. <module name="JavadocPackage">
  52. <property name="severity" value="info" />
  53. </module>
  54. <!-- Checks whether files end with a new line. -->
  55. <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
  56. <module name="NewlineAtEndOfFile">
  57. <property name="severity" value="warning" />
  58. </module>
  59. <module name="RegexpMultiline">
  60. <property name="message"
  61. value="File contains carriage return (Windows newlines)" />
  62. <property name="format" value="\r" />
  63. </module>
  64. <!-- Checks that property files contain the same keys. -->
  65. <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
  66. <module name="Translation">
  67. <property name="severity" value="warning" />
  68. </module>
  69. <!-- Checks for Size Violations. -->
  70. <!-- See http://checkstyle.sf.net/config_sizes.html -->
  71. <module name="FileLength">
  72. <property name="severity" value="ignore" />
  73. </module>
  74. <!-- Checks for whitespace -->
  75. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  76. <module name="FileTabCharacter">
  77. <property name="severity" value="warning" />
  78. </module>
  79. <!-- Checks for Headers -->
  80. <!-- See http://checkstyle.sf.net/config_header.html -->
  81. <module name="Header">
  82. <property name="headerFile" value="${checkstyle.header.file}" />
  83. <property name="fileExtensions" value="java" />
  84. <!-- ignore empty lines that may or may not have trailing white-space -->
  85. <property name="ignoreLines" value="3, 7, 9"/>
  86. </module>
  87. <module name="TreeWalker">
  88. <property name="severity" value="warning" />
  89. <!-- Custom checks to check serializable, neither is working because
  90. checkstyle can't load the classes. <module name="com.vaadin.checks.CheckClassesSerializable"/>
  91. <module name="com.vaadin.checks.IsSerializableClassCheck"/> -->
  92. <!-- Checks for Javadoc comments. -->
  93. <!-- See http://checkstyle.sf.net/config_javadoc.html -->
  94. <module name="JavadocMethod">
  95. <property name="severity" value="info" />
  96. </module>
  97. <module name="JavadocType">
  98. <property name="severity" value="info" />
  99. </module>
  100. <module name="JavadocVariable">
  101. <property name="severity" value="info" />
  102. </module>
  103. <module name="JavadocStyle">
  104. <property name="severity" value="info" />
  105. </module>
  106. <!-- Checks for Naming Conventions. -->
  107. <!-- See http://checkstyle.sf.net/config_naming.html -->
  108. <module name="ConstantName" />
  109. <module name="LocalFinalVariableName" />
  110. <module name="LocalVariableName" />
  111. <module name="MemberName" />
  112. <module name="MethodName" />
  113. <module name="PackageName" />
  114. <module name="ParameterName" />
  115. <module name="StaticVariableName">
  116. <property name="applyToPublic" value="false" />
  117. </module>
  118. <module name="StaticVariableName">
  119. <property name="applyToPublic" value="true" />
  120. <property name="applyToProtected" value="false" />
  121. <property name="applyToPackage" value="false" />
  122. <property name="applyToPrivate" value="false" />
  123. <property name="format" value="^[A-Z_]*$" />
  124. </module>
  125. <module name="TypeName" />
  126. <!-- Checks for imports -->
  127. <!-- See http://checkstyle.sf.net/config_import.html -->
  128. <module name="AvoidStarImport" />
  129. <module name="IllegalImport" /> <!-- defaults to sun.* packages -->
  130. <module name="RedundantImport" />
  131. <module name="UnusedImports" />
  132. <!--
  133. <module name="ImportControl">
  134. <property name="file" value="${checkstyle.importControl.file}" />
  135. <property name="severity" value="error" />
  136. </module>
  137. -->
  138. <!-- Checks for Size Violations. -->
  139. <!-- See http://checkstyle.sf.net/config_sizes.html -->
  140. <!--
  141. <module name="LineLength">
  142. <property name="severity" value="warning" />
  143. </module>
  144. -->
  145. <module name="MethodLength">
  146. <property name="severity" value="warning" />
  147. </module>
  148. <module name="ParameterNumber">
  149. <property name="severity" value="warning" />
  150. </module>
  151. <!-- Checks for whitespace -->
  152. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  153. <module name="EmptyForIteratorPad" />
  154. <module name="GenericWhitespace" />
  155. <module name="MethodParamPad" />
  156. <module name="NoWhitespaceAfter">
  157. <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
  158. </module>
  159. <module name="NoWhitespaceBefore" />
  160. <module name="OperatorWrap" />
  161. <module name="ParenPad" />
  162. <module name="TypecastParenPad" />
  163. <module name="WhitespaceAfter" />
  164. <module name="WhitespaceAround" />
  165. <!-- Check for trailing white space in Java code -->
  166. <module name="RegexpSinglelineJava">
  167. <!-- Ensure no whitespace at the end of line, excluding comments -->
  168. <property name="format" value="\s+$" />
  169. <property name="minimum" value="0" />
  170. <property name="maximum" value="0" />
  171. <property name="message"
  172. value="Java code has trailing white space." />
  173. <property name="severity" value="warning" />
  174. <property name="ignoreComments" value="true" />
  175. </module>
  176. <!-- Modifier Checks -->
  177. <!-- See http://checkstyle.sf.net/config_modifiers.html -->
  178. <module name="ModifierOrder" />
  179. <!--
  180. <module name="RedundantModifier">
  181. <property name="severity" value="warning" />
  182. </module>
  183. -->
  184. <!-- Checks for blocks. You know, those {}'s -->
  185. <!-- See http://checkstyle.sf.net/config_blocks.html -->
  186. <module name="AvoidNestedBlocks" />
  187. <module name="EmptyBlock">
  188. <property name="severity" value="warning" />
  189. </module>
  190. <module name="LeftCurly" />
  191. <module name="NeedBraces" />
  192. <module name="RightCurly" />
  193. <!-- Checks for common coding problems -->
  194. <!-- See http://checkstyle.sf.net/config_coding.html -->
  195. <module name="AvoidInlineConditionals">
  196. <property name="severity" value="ignore" />
  197. </module>
  198. <module name="EmptyStatement" />
  199. <module name="EqualsHashCode" />
  200. <!--
  201. <module name="HiddenField">
  202. <property name="ignoreConstructorParameter" value="true" />
  203. <property name="ignoreSetter" value="true" />
  204. <property name="ignoreAbstractMethods" value="true" />
  205. </module>
  206. -->
  207. <module name="IllegalInstantiation" />
  208. <module name="InnerAssignment" />
  209. <module name="MagicNumber">
  210. <property name="severity" value="ignore" />
  211. </module>
  212. <module name="MissingSwitchDefault" />
  213. <module name="SimplifyBooleanExpression" />
  214. <module name="SimplifyBooleanReturn" />
  215. <!-- Checks for class design -->
  216. <!-- See http://checkstyle.sf.net/config_design.html -->
  217. <module name="DesignForExtension">
  218. <property name="severity" value="ignore" />
  219. </module>
  220. <module name="FinalClass" />
  221. <module name="HideUtilityClassConstructor" />
  222. <module name="InterfaceIsType" />
  223. <module name="VisibilityModifier">
  224. <property name="severity" value="ignore" />
  225. </module>
  226. <!-- Miscellaneous other checks. -->
  227. <!-- See http://checkstyle.sf.net/config_misc.html -->
  228. <module name="ArrayTypeStyle" />
  229. <module name="FinalParameters">
  230. <property name="severity" value="ignore" />
  231. </module>
  232. <module name="TodoComment">
  233. <property name="severity" value="warning" />
  234. </module>
  235. <module name="UpperEll">
  236. <property name="severity" value="warning" />
  237. </module>
  238. <!-- Check for System.err/out.println -->
  239. <module name="RegexpSinglelineJava">
  240. <property name="format" value="System\.out\.println" />
  241. </module>
  242. <module name="RegexpSinglelineJava">
  243. <property name="format" value="System\.err\.println" />
  244. </module>
  245. </module>
  246. </module>