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.

138 lines
5.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!--编码字符集-->
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java"/>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="FileLength">
<property name="max" value="1000"/>
<property name="severity" value="error"/>
</module>
<!--检查项规则配置-->
<module name="TreeWalker">
<!-- 命名检查 -->
<module name="AbbreviationAsWordInName"/>
<module name="AbstractClassName">
<property name="ignoreModifier" value="true"/>
</module>
<module name="CatchParameterName"/>
<module name="ClassTypeParameterName"/>
<module name="ConstantName"/>
<module name="InterfaceTypeParameterName">
<property name="format" value="^[a-zA-Z]$"/>
</module>
<module name="LambdaParameterName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<property name="severity" value="error"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z]([a-zA-Z0-9])*$"/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="^[a-zA-Z]$"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z][_a-zA-Z0-9]+$"/>
</module>
<module name="StaticVariableName">
<property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/>
</module>
<module name="TypeName">
<property name="format" value="^[A-Z](_?[a-zA-Z0-9]+)*$"/>
</module>
<module name="TypeName">
<property name="format"
value="^I_[a-zA-Z0-9]*$"/>
<property name="tokens"
value="INTERFACE_DEF"/>
</module>
<!--
空格检查,该检查是为了增加代码的可读性、可维护性
-->
<module name="EmptyForInitializerPad">
<property name="option" value="nospace"/>
</module>
<module name="EmptyForIteratorPad">
<property name="option" value="space"/>
</module>
<module name="EmptyLineSeparator">
<property name="tokens" value="VARIABLE_DEF, METHOD_DEF"/>
</module>
<module name="MethodParamPad">
<property name="tokens" value="METHOD_DEF"/>
<property name="option" value="nospace"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="NoLineWrap">
<property name="tokens" value="IMPORT"/>
</module>
<module name="NoWhitespaceAfter">
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="SingleSpaceSeparator"/>
<module name="TypecastParenPad">
<property name="option" value="space"/>
</module>
<module name="WhitespaceAfter">
<property name="tokens" value="COMMA, SEMI, TYPECAST, LITERAL_ELSE"/>
</module>
<module name="WhitespaceAround">
<!-- else、catch、finally、赋值符、运算符、连接符-->
<property name="tokens" value="ASSIGN, BOR, BOR_ASSIGN, EQUAL, GE, GT, LAMBDA, LAND, LE, LITERAL_CATCH, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_SYNCHRONIZED, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
</module>
<!--
Size检查依然是解决可读性
方法体大小、文件大小等
-->
<module name="AnonInnerLength">
<property name="max" value="80"/>
<property name="severity" value="error"/>
</module>
<module name="ExecutableStatementCount"/>
<module name="MethodCount">
<property name="maxTotal" value="30"/>
<property name="severity" value="error"/>
</module>
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF"/>
<property name="max" value="80"/>
<property name="countEmpty" value="false"/>
<property name="severity" value="error"/>
</module>
<module name="OuterTypeNumber"/>
<module name="ParameterNumber"/>
<!-- NeedBraces 检查是否应该使用括号的地方没有加括号
tokens: 定义检查的类型 -->
<module name="NeedBraces">
<property name="severity" value="error"/>
</module>
<!-- if-else嵌套语句个数 最多4层 -->
<module name="NestedIfDepth">
<property name="max" value="3"/>
<property name="severity" value="error"/>
</module>
</module>
</module>