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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. </module>
  85. <module name="TreeWalker">
  86. <property name="severity" value="warning" />
  87. <!-- Custom checks to check serializable, neither is working because
  88. checkstyle can't load the classes. <module name="com.vaadin.checks.CheckClassesSerializable"/>
  89. <module name="com.vaadin.checks.IsSerializableClassCheck"/> -->
  90. <!-- Checks for Javadoc comments. -->
  91. <!-- See http://checkstyle.sf.net/config_javadoc.html -->
  92. <module name="JavadocMethod">
  93. <property name="severity" value="info" />
  94. </module>
  95. <module name="JavadocType">
  96. <property name="severity" value="info" />
  97. </module>
  98. <module name="JavadocVariable">
  99. <property name="severity" value="info" />
  100. </module>
  101. <module name="JavadocStyle">
  102. <property name="severity" value="info" />
  103. </module>
  104. <!-- Checks for Naming Conventions. -->
  105. <!-- See http://checkstyle.sf.net/config_naming.html -->
  106. <module name="ConstantName" />
  107. <module name="LocalFinalVariableName" />
  108. <module name="LocalVariableName" />
  109. <module name="MemberName" />
  110. <module name="MethodName" />
  111. <module name="PackageName" />
  112. <module name="ParameterName" />
  113. <module name="StaticVariableName">
  114. <property name="applyToPublic" value="false" />
  115. </module>
  116. <module name="StaticVariableName">
  117. <property name="applyToPublic" value="true" />
  118. <property name="applyToProtected" value="false" />
  119. <property name="applyToPackage" value="false" />
  120. <property name="applyToPrivate" value="false" />
  121. <property name="format" value="^[A-Z_]*$" />
  122. </module>
  123. <module name="TypeName" />
  124. <!-- Checks for imports -->
  125. <!-- See http://checkstyle.sf.net/config_import.html -->
  126. <module name="AvoidStarImport" />
  127. <module name="IllegalImport" /> <!-- defaults to sun.* packages -->
  128. <module name="RedundantImport" />
  129. <module name="UnusedImports" />
  130. <module name="ImportControl">
  131. <property name="file" value="${checkstyle.importControl.file}" />
  132. <property name="severity" value="error" />
  133. </module>
  134. <!-- Checks for Size Violations. -->
  135. <!-- See http://checkstyle.sf.net/config_sizes.html -->
  136. <module name="LineLength">
  137. <property name="severity" value="warning" />
  138. </module>
  139. <module name="MethodLength">
  140. <property name="severity" value="warning" />
  141. </module>
  142. <module name="ParameterNumber">
  143. <property name="severity" value="warning" />
  144. </module>
  145. <!-- Checks for whitespace -->
  146. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  147. <module name="EmptyForIteratorPad" />
  148. <module name="GenericWhitespace" />
  149. <module name="MethodParamPad" />
  150. <module name="NoWhitespaceAfter" />
  151. <module name="NoWhitespaceBefore" />
  152. <module name="OperatorWrap" />
  153. <module name="ParenPad" />
  154. <module name="TypecastParenPad" />
  155. <module name="WhitespaceAfter" />
  156. <module name="WhitespaceAround" />
  157. <!-- Check for trailing white space in Java code -->
  158. <module name="RegexpSinglelineJava">
  159. <!-- Ensure no whitespace at the end of line, excluding comments -->
  160. <property name="format" value="\s+$" />
  161. <property name="minimum" value="0" />
  162. <property name="maximum" value="0" />
  163. <property name="message"
  164. value="Java code has trailing white space." />
  165. <property name="severity" value="warning" />
  166. <property name="ignoreComments" value="true" />
  167. </module>
  168. <!-- Modifier Checks -->
  169. <!-- See http://checkstyle.sf.net/config_modifiers.html -->
  170. <module name="ModifierOrder" />
  171. <module name="RedundantModifier">
  172. <property name="severity" value="warning" />
  173. </module>
  174. <!-- Checks for blocks. You know, those {}'s -->
  175. <!-- See http://checkstyle.sf.net/config_blocks.html -->
  176. <module name="AvoidNestedBlocks" />
  177. <module name="EmptyBlock">
  178. <property name="severity" value="warning" />
  179. </module>
  180. <module name="LeftCurly" />
  181. <module name="NeedBraces" />
  182. <module name="RightCurly" />
  183. <!-- Checks for common coding problems -->
  184. <!-- See http://checkstyle.sf.net/config_coding.html -->
  185. <module name="AvoidInlineConditionals">
  186. <property name="severity" value="ignore" />
  187. </module>
  188. <module name="EmptyStatement" />
  189. <module name="EqualsHashCode" />
  190. <module name="HiddenField">
  191. <property name="ignoreConstructorParameter" value="true" />
  192. <property name="ignoreSetter" value="true" />
  193. <property name="ignoreAbstractMethods" value="true" />
  194. </module>
  195. <module name="IllegalInstantiation" />
  196. <module name="InnerAssignment" />
  197. <module name="MagicNumber">
  198. <property name="severity" value="ignore" />
  199. </module>
  200. <module name="MissingSwitchDefault" />
  201. <module name="RedundantThrows">
  202. <property name="severity" value="warning" />
  203. </module>
  204. <module name="SimplifyBooleanExpression" />
  205. <module name="SimplifyBooleanReturn" />
  206. <!-- Checks for class design -->
  207. <!-- See http://checkstyle.sf.net/config_design.html -->
  208. <module name="DesignForExtension">
  209. <property name="severity" value="ignore" />
  210. </module>
  211. <module name="FinalClass" />
  212. <module name="HideUtilityClassConstructor" />
  213. <module name="InterfaceIsType" />
  214. <module name="VisibilityModifier">
  215. <property name="severity" value="ignore" />
  216. </module>
  217. <!-- Miscellaneous other checks. -->
  218. <!-- See http://checkstyle.sf.net/config_misc.html -->
  219. <module name="ArrayTypeStyle" />
  220. <module name="FinalParameters">
  221. <property name="severity" value="ignore" />
  222. </module>
  223. <module name="TodoComment">
  224. <property name="severity" value="warning" />
  225. </module>
  226. <module name="UpperEll">
  227. <property name="severity" value="warning" />
  228. </module>
  229. <!-- Check for System.err/out.println -->
  230. <module name="RegexpSinglelineJava">
  231. <property name="format" value="System\.out\.println" />
  232. </module>
  233. <module name="RegexpSinglelineJava">
  234. <property name="format" value="System\.err\.println" />
  235. </module>
  236. </module>
  237. </module>