我知道有QAPlug - Checkstyle,我正在尝试使用它。
在菜单项目设置 - >中 QAPlug - > Checkstyle 我也设置了 Xml配置文件和 Jar文件。然后当按下检查加载的规则按钮时,会弹出一条消息:
这是一个非常好的插件,它在XML文件中找到了规则。为什么不加载它们呢?
我正在使用的Checkstyle配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="severity" value="error"/>
<module name="TreeWalker">
<property name="cacheFile" value="build/checkstyle.cache"/>
<module name="FileContentsHolder"/>
<module name="RegexpSinglelineJava">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="^\t* +\t*\S"/>
<property name="message"
value="Line has leading space characters; indentation should be performed with tabs only."/>
<property name="ignoreComments" value="true"/>
</module>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport">
<property name="illegalPkgs" value="sun, junit.framework, org.hamcrest.CoreMatchers"/>
</module>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="ImportOrder">
<property name="groups" value="/^((?!java).)*$/,/javax\./,/java\./"/>
<property name="ordered" value="true"/>
<property name="separated" value="false"/>
<property name="option" value="bottom"/>
</module>
<module name="ParameterAssignment"/>
<module name="LineLength">
<property name="max" value="180"/>
<property name="tabWidth" value="1"/>
<property name="ignorePattern" value="(^import)|(\s*@ScenarioReference)|(\s*@ScenarioDescription)|(\s*title)|(\s*story)|(\s*@Given)|(\s*@When)|(\s*@Then)|(\s*@Alias)"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber">
<property name="max" value="8"/>
</module>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens"
value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<!--Please be aware of this bug: http://sourceforge.net/p/checkstyle/bugs/593/-->
<!--[checkstyle-bugs-593] WhitespaceAround wrongly targets annotation element arrays-->
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true" />
</module>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="severity" value="warning"/>
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3, 4, -4"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="FinalClass"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
<property name="publicMemberPattern" value="^expectedException$|^temporaryFolder$|^exitRule$|^synchronizedTestRule$|^clearDatabaseRule.*$|^configurationRule$"/>
</module>
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
</module>
<module name="Translation"/>
<module name="FileLength"/>
<module name="SuppressionCommentFilter"/>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE\:(\w+)\:OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE\:(\w+)\:ON"/>
<property name="checkFormat" value="$1"/>
</module>
</module>