seata_checkstyle.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Copyright 1999-2019 Seata.io Group.
  4. ~
  5. ~ Licensed under the Apache License, Version 2.0 (the "License");
  6. ~ you may not use this file except in compliance with the License.
  7. ~ You may obtain a copy of the License at
  8. ~
  9. ~ http://www.apache.org/licenses/LICENSE-2.0
  10. ~
  11. ~ Unless required by applicable law or agreed to in writing, software
  12. ~ distributed under the License is distributed on an "AS IS" BASIS,
  13. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ~ See the License for the specific language governing permissions and
  15. ~ limitations under the License.
  16. -->
  17. <!DOCTYPE module PUBLIC
  18. "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
  19. "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
  20. <!--Refer http://checkstyle.sourceforge.net/reports/google-java-style.html#s2.2-file-encoding -->
  21. <module name="Checker">
  22. <property name="localeLanguage" value="en"/>
  23. <!--To configure the check to report on the first instance in each file-->
  24. <module name="FileTabCharacter"/>
  25. <!-- header -->
  26. <module name="RegexpHeader">
  27. <property name="header" value="^.*$\n[\*\s]Copyright 1999-2019 Seata.io Group."/>
  28. <property name="fileExtensions" value="java"/>
  29. </module>
  30. <module name="RegexpHeader">
  31. <property name="header" value="^.*$\n[#\s]Copyright 1999-2019 Seata.io Group."/>
  32. <property name="fileExtensions" value="properties"/>
  33. </module>
  34. <module name="RegexpSingleline">
  35. <property name="format" value="System\.out\.println"/>
  36. <property name="message" value="Prohibit invoking System.out.println in source code !"/>
  37. </module>
  38. <module name="RegexpSingleline">
  39. <property name="format" value="//FIXME"/>
  40. <property name="message" value="Recommended fix FIXME task !"/>
  41. </module>
  42. <module name="RegexpSingleline">
  43. <property name="format" value="//TODO"/>
  44. <property name="message" value="Recommended fix TODO task !"/>
  45. </module>
  46. <module name="RegexpSingleline">
  47. <property name="format" value="@taobao"/>
  48. <property name="message" value="Recommended remove @taobao keyword!"/>
  49. </module>
  50. <module name="RegexpSingleline">
  51. <property name="format"
  52. value=".*[\u3400-\u4DB5\u4E00-\u9FA5\u9FA6-\u9FBB\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFF00-\uFFEF\u2E80-\u2EFF\u3000-\u303F\u31C0-\u31EF]+.*"/>
  53. <property name="message" value="Not allow chinese character !"/>
  54. </module>
  55. <module name="FileLength">
  56. <property name="max" value="3000"/>
  57. </module>
  58. <module name="TreeWalker">
  59. <module name="UnusedImports">
  60. <property name="processJavadoc" value="true"/>
  61. </module>
  62. <module name="RedundantImport"/>
  63. <!--<module name="IllegalImport" />-->
  64. <!--Checks that classes that override equals() also override hashCode()-->
  65. <module name="EqualsHashCode"/>
  66. <!--Checks for over-complicated boolean expressions. Currently finds code like if (topic == true), topic || true, !false, etc.-->
  67. <module name="SimplifyBooleanExpression"/>
  68. <module name="OneStatementPerLine"/>
  69. <module name="UnnecessaryParentheses"/>
  70. <!--Checks for over-complicated boolean return statements. For example the following code-->
  71. <module name="SimplifyBooleanReturn"/>
  72. <!--Check that the default is after all the cases in producerGroup switch statement-->
  73. <module name="DefaultComesLast"/>
  74. <!--Detects empty statements (standalone ";" semicolon)-->
  75. <module name="EmptyStatement"/>
  76. <!--Checks that long constants are defined with an upper ell-->
  77. <module name="UpperEll"/>
  78. <module name="ConstantName">
  79. <property name="format" value="(^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$)|(^log$)"/>
  80. </module>
  81. <!--Checks that local, non-final variable names conform to producerGroup format specified by the format property-->
  82. <module name="LocalVariableName"/>
  83. <!--Validates identifiers for local, final variables, including catch parameters-->
  84. <module name="LocalFinalVariableName"/>
  85. <!--Validates identifiers for non-static fields-->
  86. <module name="MemberName"/>
  87. <!--Validates identifiers for class type parameters-->
  88. <module name="ClassTypeParameterName">
  89. <property name="format" value="^[A-Z0-9]*$"/>
  90. </module>
  91. <!--Validates identifiers for method type parameters-->
  92. <module name="MethodTypeParameterName">
  93. <property name="format" value="^[A-Z0-9]*$"/>
  94. </module>
  95. <module name="PackageName"/>
  96. <module name="ParameterName"/>
  97. <module name="StaticVariableName">
  98. <property name="format" value="^[a-zA-Z0-9_]*$"/>
  99. </module>
  100. <module name="TypeName"/>
  101. <!--Checks that there are no import statements that use the * notation-->
  102. <module name="AvoidStarImport"/>
  103. <!-- unused imports -->
  104. <module name="UnusedImports"/>
  105. <!--whitespace-->
  106. <module name="GenericWhitespace"/>
  107. <!--<module name="NoWhitespaceBefore"/>-->
  108. <!--<module name="NoWhitespaceAfter"/>-->
  109. <module name="WhitespaceAround">
  110. <property name="allowEmptyConstructors" value="true"/>
  111. <property name="allowEmptyMethods" value="true"/>
  112. </module>
  113. <module name="Indentation"/>
  114. <module name="MethodParamPad"/>
  115. <module name="ParenPad"/>
  116. <module name="TypecastParenPad"/>
  117. </module>
  118. </module>