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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. - Modified the severity of the following Checks from error to warning and the scope from private to protected:
  21. • JavadocType (class and interface declarations)
  22. • JavadocMethod (method declarations)
  23. • JavadocVariable (variable declarations)
  24. • JavadocStyle (Javadocs are "well formed")
  25. - Modified the severity of the following Checks from error to warning because 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. <!--
  52. <module name="JavadocPackage">
  53. <property name="severity" value="info" />
  54. </module>
  55. -->
  56. <!-- Checks whether files end with a new line. -->
  57. <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
  58. <module name="NewlineAtEndOfFile">
  59. <property name="severity" value="warning" />
  60. </module>
  61. <!-- Checks that property files contain the same keys. -->
  62. <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
  63. <module name="Translation">
  64. <property name="severity" value="warning" />
  65. </module>
  66. <!-- Checks for Size Violations. -->
  67. <!-- See http://checkstyle.sf.net/config_sizes.html -->
  68. <module name="FileLength">
  69. <property name="severity" value="ignore" />
  70. </module>
  71. <!-- Checks for whitespace -->
  72. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  73. <module name="FileTabCharacter">
  74. <property name="severity" value="warning" />
  75. </module>
  76. <!-- Checks for Headers -->
  77. <!-- See http://checkstyle.sf.net/config_header.html -->
  78. <module name="Header">
  79. <property name="headerFile" value="${checkstyle.header.file}" />
  80. <property name="fileExtensions" value="java" />
  81. <!-- ignore empty lines that may or may not have trailing white-space -->
  82. <property name="ignoreLines" value="3, 7, 9"/>
  83. </module>
  84. <module name="TreeWalker">
  85. <property name="severity" value="warning" />
  86. <!-- Custom checks to check serializable, neither is working because
  87. checkstyle 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="warning" />
  93. <property name="scope" value="protected" />
  94. </module>
  95. <module name="JavadocType">
  96. <property name="severity" value="warning" />
  97. <property name="scope" value="protected" />
  98. </module>
  99. <module name="JavadocVariable">
  100. <property name="severity" value="warning" />
  101. <property name="scope" value="protected" />
  102. </module>
  103. <module name="JavadocStyle">
  104. <property name="severity" value="warning" />
  105. <property name="scope" value="protected" />
  106. </module>
  107. <!-- Checks for Naming Conventions. -->
  108. <!-- See http://checkstyle.sf.net/config_naming.html -->
  109. <module name="ConstantName" />
  110. <module name="LocalFinalVariableName" />
  111. <module name="LocalVariableName" />
  112. <module name="MemberName" />
  113. <module name="MethodName" />
  114. <module name="PackageName" />
  115. <module name="ParameterName" />
  116. <module name="StaticVariableName">
  117. <property name="applyToPublic" value="false" />
  118. </module>
  119. <module name="StaticVariableName">
  120. <property name="applyToPublic" value="true" />
  121. <property name="applyToProtected" value="false" />
  122. <property name="applyToPackage" value="false" />
  123. <property name="applyToPrivate" value="false" />
  124. <property name="format" value="^[A-Z_]*$" />
  125. </module>
  126. <module name="TypeName" />
  127. <!-- Checks for imports -->
  128. <!-- See http://checkstyle.sf.net/config_import.html -->
  129. <module name="AvoidStarImport" />
  130. <module name="IllegalImport" /> <!-- defaults to sun.* packages -->
  131. <module name="RedundantImport" />
  132. <module name="UnusedImports" />
  133. <!--
  134. <module name="ImportControl">
  135. <property name="file" value="${checkstyle.importControl.file}" />
  136. <property name="severity" value="error" />
  137. </module>
  138. -->
  139. <!-- Checks for Size Violations. -->
  140. <!-- See http://checkstyle.sf.net/config_sizes.html -->
  141. <!--
  142. <module name="LineLength">
  143. <property name="severity" value="warning" />
  144. </module>
  145. -->
  146. <module name="MethodLength">
  147. <property name="severity" value="warning" />
  148. </module>
  149. <module name="ParameterNumber">
  150. <property name="severity" value="warning" />
  151. </module>
  152. <!-- Checks for whitespace -->
  153. <!-- See http://checkstyle.sf.net/config_whitespace.html -->
  154. <module name="EmptyForIteratorPad" />
  155. <module name="GenericWhitespace" />
  156. <module name="MethodParamPad" />
  157. <module name="NoWhitespaceAfter">
  158. <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
  159. </module>
  160. <module name="NoWhitespaceBefore" />
  161. <module name="OperatorWrap" />
  162. <module name="ParenPad" />
  163. <module name="TypecastParenPad" />
  164. <module name="WhitespaceAfter" />
  165. <module name="WhitespaceAround" />
  166. <!-- Check for trailing white space in Java code -->
  167. <module name="RegexpSinglelineJava">
  168. <!-- Ensure no whitespace at the end of line, excluding comments -->
  169. <property name="format" value="\s+$" />
  170. <property name="minimum" value="0" />
  171. <property name="maximum" value="0" />
  172. <property name="message"
  173. value="Java code has trailing white space." />
  174. <property name="severity" value="warning" />
  175. <property name="ignoreComments" value="true" />
  176. </module>
  177. <!-- Modifier Checks -->
  178. <!-- See http://checkstyle.sf.net/config_modifiers.html -->
  179. <module name="ModifierOrder" />
  180. <!--
  181. <module name="RedundantModifier">
  182. <property name="severity" value="warning" />
  183. </module>
  184. -->
  185. <!-- Checks for blocks. You know, those {}'s -->
  186. <!-- See http://checkstyle.sf.net/config_blocks.html -->
  187. <module name="AvoidNestedBlocks" />
  188. <module name="EmptyBlock">
  189. <property name="severity" value="warning" />
  190. </module>
  191. <module name="LeftCurly" />
  192. <module name="NeedBraces" />
  193. <module name="RightCurly" />
  194. <!-- Checks for common coding problems -->
  195. <!-- See http://checkstyle.sf.net/config_coding.html -->
  196. <module name="AvoidInlineConditionals">
  197. <property name="severity" value="ignore" />
  198. </module>
  199. <module name="EmptyStatement" />
  200. <module name="EqualsHashCode" />
  201. <!--
  202. <module name="HiddenField">
  203. <property name="ignoreConstructorParameter" value="true" />
  204. <property name="ignoreSetter" value="true" />
  205. <property name="ignoreAbstractMethods" value="true" />
  206. </module>
  207. -->
  208. <module name="IllegalInstantiation" />
  209. <module name="InnerAssignment" />
  210. <module name="MagicNumber">
  211. <property name="severity" value="ignore" />
  212. </module>
  213. <module name="MissingSwitchDefault" />
  214. <module name="SimplifyBooleanExpression" />
  215. <module name="SimplifyBooleanReturn" />
  216. <!-- Checks for class design -->
  217. <!-- See http://checkstyle.sf.net/config_design.html -->
  218. <module name="DesignForExtension">
  219. <property name="severity" value="ignore" />
  220. </module>
  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 name="SuppressionFilter">
  247. <property name="file" value="${config_loc}/suppressions.xml" />
  248. </module>
  249. </module>