ruleset: fix order of properties and adjust indentation

This commit is contained in:
Paul Campbell 2018-08-26 15:49:02 +01:00
parent f5665a0733
commit ee7eb75ffb
6 changed files with 107 additions and 105 deletions

View file

@ -27,6 +27,7 @@ import lombok.Setter;
import net.kemitix.conditional.Value;
import java.net.URI;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@ -46,7 +47,7 @@ public class Rule {
private static final String MODULE_NO_PROPERTIES = "<module name=\"%s\"/>";
private static final String MODULE_WITH_PROPERTIES = "<module name=\"%s\">%n %s%n</module>";
private static final String MODULE_WITH_PROPERTIES = "<module name=\"%s\">%n%s%n</module>";
/**
* Configuration properties.
@ -133,7 +134,8 @@ public class Rule {
private static String formatProperties(final Map<String, String> properties) {
return MapStream.of(properties)
.map((k, v) -> String.format("<property name=\"%s\" value=\"%s\"/>", k, v))
.sorted(Comparator.comparing(Map.Entry::getKey))
.map((k, v) -> String.format(" <property name=\"%s\" value=\"%s\"/>", k, v))
.collect(Collectors.joining(System.lineSeparator()));
}

View file

@ -6,12 +6,12 @@
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpOnFilenameCheck">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
<property name="match" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck">
<property name="fileExtensions" value="java"/>
<property name="headerFile" value="LICENSE.txt"/>
<property name="headerFile" value="LICENSE.txt"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck">
<property name="lineSeparator" value="lf"/>
@ -35,8 +35,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck">
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck"/>
@ -45,8 +45,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck">
<property name="option" value="nl"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.TrailingCommentCheck"/>

View file

@ -6,12 +6,12 @@
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpOnFilenameCheck">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
<property name="match" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck">
<property name="fileExtensions" value="java"/>
<property name="headerFile" value="LICENSE.txt"/>
<property name="headerFile" value="LICENSE.txt"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck">
<property name="lineSeparator" value="lf"/>
@ -52,8 +52,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck">
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck"/>
@ -66,8 +66,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck">
<property name="option" value="nl"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.naming.StaticVariableNameCheck"/>

View file

@ -6,12 +6,12 @@
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpOnFilenameCheck">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
<property name="match" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck">
<property name="fileExtensions" value="java"/>
<property name="headerFile" value="LICENSE.txt"/>
<property name="headerFile" value="LICENSE.txt"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck">
@ -44,8 +44,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck">
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="validateThrows" value="true"/>
<property name="scope" value="package"/>
<property name="scope" value="package"/>
<property name="validateThrows" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
@ -69,8 +69,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck">
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck"/>
@ -84,8 +84,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck">
<property name="option" value="nl"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.naming.StaticVariableNameCheck"/>

View file

@ -6,12 +6,12 @@
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpOnFilenameCheck">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
<property name="match" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck">
<property name="fileExtensions" value="java"/>
<property name="headerFile" value="LICENSE.txt"/>
<property name="headerFile" value="LICENSE.txt"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck">
@ -56,7 +56,7 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.GenericWhitespaceCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.design.HideUtilityClassConstructorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck"/>
@ -71,8 +71,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck">
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="validateThrows" value="true"/>
<property name="scope" value="package"/>
<property name="scope" value="package"/>
<property name="validateThrows" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
@ -103,8 +103,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck">
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck"/>
@ -125,8 +125,8 @@
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck">
<property name="option" value="nl"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.naming.StaticVariableNameCheck"/>

View file

@ -6,7 +6,7 @@
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpOnFilenameCheck">
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
<property name="match" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck">
<property name="max" value="500"/>
@ -14,7 +14,7 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck">
<property name="fileExtensions" value="java"/>
<property name="headerFile" value="LICENSE.txt"/>
<property name="headerFile" value="LICENSE.txt"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck">
@ -75,7 +75,7 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.GenericWhitespaceCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.design.HideUtilityClassConstructorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck"/>
@ -91,16 +91,16 @@
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck">
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="validateThrows" value="true"/>
<property name="scope" value="package"/>
<property name="scope" value="package"/>
<property name="validateThrows" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.metrics.JavaNCSSCheck">
<property name="classMaximum" value="250"/>
<property name="fileMaximum" value="250"/>
<property name="methodMaximum" value="12"/>
<property name="fileMaximum" value="250"/>
<property name="methodMaximum" value="12"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck">
@ -139,8 +139,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck">
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.metrics.NPathComplexityCheck">
@ -168,8 +168,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.coding.ReturnCountCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck">
<property name="option" value="nl"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanExpressionCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanReturnCheck"/>