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 10KB

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