在创建SonarQube质量配置文件时,我提供了checkstyle文件。创建质量配置文件后,我检查哪个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="warning"/>
<module name="TreeWalker">
<module name="FileContentsHolder"/>
<module name="CyclomaticComplexity">
<property name="severity" value="warning"/>
<property name="max" value="25"/>
</module>
<module name="InterfaceIsType">
<property name="severity" value="warning"/>
</module>
<module name="HiddenFieldCheck">
<property name="severity" value="warning"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="ignoreAbstractMethods" value="true"/>
</module>
<module name="TypecastParenPadCheck">
<property name="severity" value="info"/>
</module>
<module name="StringLiteralEquality">
<property name="severity" value="warning"/>
</module>
<module name="LocalVariableNameCheck">
<property name="severity" value="warning"/>
</module>
<module name="NoWhitespaceBeforeCheck">
<property name="severity" value="info"/>
</module>
<module name="RedundantImport">
<property name="severity" value="warning"/>
</module>
<module name="AnonInnerLength">
<property name="severity" value="warning"/>
<property name="max" value="50"/>
</module>
<module name="StaticVariableNameCheck">
<property name="severity" value="warning"/>
</module>
<module name="ParameterName">
<property name="severity" value="warning"/>
</module>
<module name="ParenPadCheck">
<property name="severity" value="info"/>
</module>
<module name="FinalClass">
<property name="severity" value="warning"/>
</module>
<module name="MethodTypeParameterName">
<property name="severity" value="warning"/>
</module>
<module name="WhitespaceAfterCheck">
<property name="severity" value="info"/>
</module>
<module name="UpperEll">
<property name="severity" value="info"/>
</module>
<module name="LocalFinalVariableName">
<property name="severity" value="warning"/>
</module>
<module name="JavadocVariableCheck">
<property name="severity" value="ignore"/>
<property name="scope" value="public"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="info"/>
</module>
<module name="TypeNameCheck">
<property name="severity" value="warning"/>
</module>
<module name="MemberNameCheck">
<property name="severity" value="warning"/>
</module>
<module name="NeedBracesCheck">
<property name="severity" value="warning"/>
</module>
<module name="VisibilityModifier">
<property name="severity" value="warning"/>
</module>
<module name="FinalParametersCheck">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="warning"/>
</module>
<module name="PackageName">
<property name="severity" value="warning"/>
</module>
<module name="ParameterAssignment">
<property name="severity" value="warning"/>
</module>
<module name="RedundantThrows">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="info"/>
</module>
<module name="IllegalImport">
<property name="severity" value="error"/>
</module>
<module name="AvoidNestedBlocks">
<property name="severity" value="warning"/>
</module>
<module name="TodoCommentCheck">
<property name="severity" value="info"/>
</module>
<module name="DesignForExtension">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="warning"/>
</module>
<module name="SimplifyBooleanReturn">
<property name="severity" value="warning"/>
</module>
<module name="HideUtilityClassConstructor">
<property name="severity" value="warning"/>
</module>
<module name="SimplifyBooleanExpression">
<property name="severity" value="warning"/>
</module>
<module name="ClassTypeParameterName">
<property name="severity" value="warning"/>
</module>
<module name="JavadocStyleCheck">
<property name="severity" value="warning"/>
</module>
<module name="BooleanExpressionComplexityCheck">
<property name="severity" value="warning"/>
</module>
<module name="InnerAssignmentCheck">
<property name="severity" value="warning"/>
</module>
<module name="MagicNumberCheck">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="warning"/>
</module>
<module name="JavadocTypeCheck">
<property name="severity" value="warning"/>
</module>
<module name="IllegalInstantiation">
<property name="severity" value="warning"/>
</module>
<module name="IllegalThrows">
<property name="severity" value="warning"/>
</module>
<module name="RedundantModifierCheck">
<property name="severity" value="warning"/>
</module>
<module name="LeftCurlyCheck">
<property name="severity" value="info"/>
</module>
<module name="TrailingComment">
<property name="severity" value="info"/>
</module>
<module name="MethodName">
<property name="severity" value="warning"/>
</module>
<module name="LineLength">
<property name="severity" value="warning"/>
<property name="max" value="160"/>
</module>
<module name="AvoidStarImport">
<property name="severity" value="warning"/>
</module>
<module name="DefaultComesLast">
<property name="severity" value="warning"/>
</module>
<module name="OperatorWrapCheck">
<property name="severity" value="info"/>
</module>
<module name="EmptyBlock">
<property name="severity" value="info"/>
</module>
<module name="MethodLengthCheck">
<property name="severity" value="warning"/>
</module>
<module name="EqualsHashCode">
<property name="severity" value="error"/>
</module>
<module name="MissingSwitchDefault">
<property name="severity" value="warning"/>
</module>
<module name="MethodParamPadCheck">
<property name="severity" value="info"/>
</module>
<module name="GenericWhitespace">
<property name="severity" value="info"/>
</module>
<module name="EmptyStatement">
<property name="severity" value="info"/>
</module>
<module name="RightCurlyCheck">
<property name="severity" value="info"/>
</module>
<module name="ConstantNameCheck">
<property name="severity" value="warning"/>
</module>
<module name="ArrayTypeStyle">
<property name="severity" value="info"/>
</module>
<module name="UnusedImports">
<property name="severity" value="warning"/>
</module>
<module name="WhitespaceAroundCheck">
<property name="severity" value="info"/>
</module>
<module name="ModifierOrder">
<property name="severity" value="warning"/>
</module>
<module name="JavadocMethodCheck">
<property name="severity" value="warning"/>
<property name="suppressLoadErrors" value="true"/>
</module>
<module name="NoWhitespaceAfterCheck">
<property name="severity" value="info"/>
</module>
<module name="FallThrough">
<property name="severity" value="warning"/>
</module>
<module name="MultipleVariableDeclarations">
<property name="severity" value="warning"/>
</module>
</module>
<module name="SuppressionCommentFilter"/>
<module name="NewlineAtEndOfFile">
<property name="severity" value="info"/>
</module>
<module name="FileTabCharacter">
<property name="severity" value="info"/>
</module>
<module name="FileLength">
<property name="severity" value="warning"/>
</module>
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="info"/>
</module>
<module name="RegexpSinglelineCheck">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${samedir}\suppressions.xml"/>
</module>
</module>
SonarQube质量资料使用的checkstyle(永久链接):
<!-- Generated by Sonar -->
<module name="Checker">
<module name="SuppressionCommentFilter"/>
<module name="SuppressWarningsFilter"/>
<module name="FileTabCharacter">
<property name="severity" value="info"/>
</module>
<module name="JavadocPackage">
<property name="severity" value="info"/>
</module>
<module name="FileLength">
<property name="severity" value="warning"/>
</module>
<module name="NewlineAtEndOfFile">
<property name="severity" value="info"/>
<property name="lineSeparator" value="system"/>
</module>
<module name="TreeWalker">
<module name="FileContentsHolder"/>
<module name="SuppressWarningsHolder"/>
<module name="AnonInnerLength">
<property name="severity" value="warning"/>
<property name="max" value="50"/>
</module>
<module name="ArrayTypeStyle">
<property name="severity" value="info"/>
</module>
<module name="AvoidNestedBlocks">
<property name="severity" value="warning"/>
</module>
<module name="AvoidStarImport">
<property name="severity" value="warning"/>
<property name="allowStaticMemberImports" value="false"/>
<property name="allowClassImports" value="false"/>
</module>
<module name="ClassTypeParameterName">
<property name="severity" value="warning"/>
<property name="format" value="^[A-Z]$"/>
</module>
<module name="CyclomaticComplexity">
<property name="severity" value="warning"/>
<property name="max" value="25"/>
<property name="switchBlockAsSingleDecisionPoint" value="false"/>
<property name="tokens" value="LITERAL_WHILE,LITERAL_DO,LITERAL_FOR,LITERAL_IF,LITERAL_SWITCH,LITERAL_CASE,LITERAL_CATCH,QUESTION,LAND,LOR"/>
</module>
<module name="DefaultComesLast">
<property name="severity" value="warning"/>
</module>
<module name="DesignForExtension">
<property name="severity" value="info"/>
</module>
<module name="EmptyBlock">
<property name="severity" value="info"/>
<property name="option" value="stmt"/>
<property name="tokens" value="LITERAL_WHILE,LITERAL_TRY,LITERAL_FINALLY,LITERAL_DO,LITERAL_IF,LITERAL_ELSE,LITERAL_FOR,INSTANCE_INIT,STATIC_INIT,LITERAL_SWITCH,LITERAL_SYNCHRONIZED"/>
</module>
<module name="EmptyStatement">
<property name="severity" value="info"/>
</module>
<module name="EqualsHashCode">
<property name="severity" value="error"/>
</module>
<module name="FallThrough">
<property name="severity" value="warning"/>
</module>
<module name="FinalClass">
<property name="severity" value="warning"/>
</module>
<module name="GenericWhitespace">
<property name="severity" value="info"/>
</module>
<module name="HideUtilityClassConstructor">
<property name="severity" value="warning"/>
</module>
<module name="IllegalImport">
<property name="severity" value="error"/>
</module>
<module name="IllegalInstantiation">
<property name="severity" value="warning"/>
</module>
<module name="IllegalThrows">
<property name="severity" value="warning"/>
<property name="ignoreOverriddenMethods" value="true"/>
</module>
<module name="InterfaceIsType">
<property name="severity" value="warning"/>
</module>
<module name="LineLength">
<property name="severity" value="warning"/>
<property name="max" value="160"/>
</module>
<module name="LocalFinalVariableName">
<property name="severity" value="warning"/>
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<module name="MethodName">
<property name="severity" value="warning"/>
<property name="allowClassName" value="false"/>
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<module name="MethodTypeParameterName">
<property name="severity" value="warning"/>
<property name="format" value="^[A-Z]$"/>
</module>
<module name="MissingSwitchDefault">
<property name="severity" value="warning"/>
</module>
<module name="ModifierOrder">
<property name="severity" value="warning"/>
</module>
<module name="MultipleVariableDeclarations">
<property name="severity" value="warning"/>
</module>
<module name="PackageName">
<property name="severity" value="warning"/>
<property name="format" value="^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$"/>
</module>
<module name="ParameterAssignment">
<property name="severity" value="warning"/>
</module>
<module name="ParameterName">
<property name="severity" value="warning"/>
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<property name="ignoreOverridden" value="false"/>
</module>
<module name="RedundantImport">
<property name="severity" value="warning"/>
</module>
<module name="SimplifyBooleanExpression">
<property name="severity" value="warning"/>
</module>
<module name="SimplifyBooleanReturn">
<property name="severity" value="warning"/>
</module>
<module name="StringLiteralEquality">
<property name="severity" value="warning"/>
</module>
<module name="TrailingComment">
<property name="severity" value="info"/>
<property name="format" value="^[\s\}\);]*$"/>
</module>
<module name="UnusedImports">
<property name="severity" value="warning"/>
<property name="processJavadoc" value="true"/>
</module>
<module name="UpperEll">
<property name="severity" value="info"/>
</module>
<module name="VisibilityModifier">
<property name="severity" value="warning"/>
<property name="allowPublicImmutableFields" value="true"/>
<property name="packageAllowed" value="false"/>
<property name="publicMemberPattern" value="^serialVersionUID$"/>
<property name="protectedAllowed" value="false"/>
<property name="ignoreAnnotationCanonicalNames" value="org.junit.Rule,com.google.common.annotations.VisibleForTesting"/>
</module>
</module>
</module>
答案 0 :(得分:0)
一些规则被java插件规则替换,其他规则已映射/未实现。你应该查看地图链接:
Sonar Java插件中引入了大多数Checkstyle规则。复制的规则在Checkstyle插件中标记为“已弃用”,因为Sonar插件具有类似的规则,但可以使用map/replaced rules (a lot of mistakes)的一些摘要。