diff --git a/pom.xml b/pom.xml index 4b95f63..9e4571e 100644 --- a/pom.xml +++ b/pom.xml @@ -142,6 +142,15 @@ + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + + run-its diff --git a/src/main/java/org/codehaus/mojo/tidy/CheckMojo.java b/src/main/java/org/codehaus/mojo/tidy/CheckMojo.java index c16979c..8a17540 100644 --- a/src/main/java/org/codehaus/mojo/tidy/CheckMojo.java +++ b/src/main/java/org/codehaus/mojo/tidy/CheckMojo.java @@ -28,7 +28,7 @@ * Checks that the pom.xml is tidy. Fails the build if mvn tidy:pom would * create a different pom.xml than the current one. */ -@Mojo( name = "check", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true) +@Mojo( name = "check", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true ) public class CheckMojo extends TidyMojo { diff --git a/src/main/java/org/codehaus/mojo/tidy/TidyMojo.java b/src/main/java/org/codehaus/mojo/tidy/TidyMojo.java index 2f4bd81..9a18462 100644 --- a/src/main/java/org/codehaus/mojo/tidy/TidyMojo.java +++ b/src/main/java/org/codehaus/mojo/tidy/TidyMojo.java @@ -45,7 +45,7 @@ public abstract class TidyMojo /** * The Maven Project. */ - @Parameter(defaultValue = "${project}", required = true, readonly = true) + @Parameter( defaultValue = "${project}", required = true, readonly = true ) protected MavenProject project; /** diff --git a/src/main/java/org/codehaus/mojo/tidy/task/EnsureOrderAndIndent.java b/src/main/java/org/codehaus/mojo/tidy/task/EnsureOrderAndIndent.java index 87e7e03..f5acc41 100644 --- a/src/main/java/org/codehaus/mojo/tidy/task/EnsureOrderAndIndent.java +++ b/src/main/java/org/codehaus/mojo/tidy/task/EnsureOrderAndIndent.java @@ -23,6 +23,7 @@ import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.XMLEvent; + import java.util.ArrayList; import java.util.List; @@ -59,7 +60,8 @@ class EnsureOrderAndIndent new SectionSorter( "build/extensions/extension", new NodeGroup( "groupId", "artifactId", "version" ) ), new SectionSorter( "/project/parent", new NodeGroup( "groupId", "artifactId", "version", "relativePath" ) ), new SectionSorter( "plugin", new NodeGroup( "groupId", "artifactId", "version" ) ), - new SectionSorter( "/project/distributionManagement/relocation", new NodeGroup( "groupId", "artifactId", "version" ) ) ); + new SectionSorter( "/project/distributionManagement/relocation", + new NodeGroup( "groupId", "artifactId", "version" ) ) ); @Override public String tidyPom( String pom, Format format ) @@ -237,7 +239,8 @@ private String formatSection( XMLEventReader reader, String pom, Format format, } addTextIfNotEmpty( output, indent, getPrecedingText( pom, starts[i], ends ), format ); addTextIfNotEmpty( output, indent, pom.substring( starts[i], ends[i] ), format ); - firstGroupStarted = groupStarted = true; + firstGroupStarted = true; + groupStarted = true; } ++i; } diff --git a/src/test/java/org/codehaus/mojo/tidy/task/PomTidyFixesTest.java b/src/test/java/org/codehaus/mojo/tidy/task/PomTidyFixesTest.java index 330b091..3e43012 100644 --- a/src/test/java/org/codehaus/mojo/tidy/task/PomTidyFixesTest.java +++ b/src/test/java/org/codehaus/mojo/tidy/task/PomTidyFixesTest.java @@ -29,28 +29,32 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; -@RunWith(Parameterized.class) -public class PomTidyFixesTest { - - protected static final String PATH = "fixes/order-and-indent-start-element-of-scope/"; - - @Parameters(name = "{0}") - public static Iterable tests() { - return asList( - "property-ending-with-plugin.pom.xml", - "property-ending-with-dependency.pom.xml" - ); - } - - @Parameter(0) - public String name; - - @Test - public void shouldThrowNoError() - throws Exception { - final String pom = IOUtil.toString(getClass().getResourceAsStream(PATH + name)); - String tidyPom = new PomTidy().tidy(pom); - assertEquals(pom, tidyPom, "nothing to tidy here"); - } +@RunWith( Parameterized.class ) +public class PomTidyFixesTest +{ + + protected static final String PATH = "fixes/order-and-indent-start-element-of-scope/"; + + @Parameters( name = "{0}" ) + public static Iterable tests() + { + return asList( + "property-ending-with-plugin.pom.xml", + "property-ending-with-dependency.pom.xml" + ); + } + + @SuppressWarnings( "checkstyle:VisibilityModifier" ) + @Parameter( 0 ) + public String name; + + @Test + public void shouldThrowNoError() + throws Exception + { + final String pom = IOUtil.toString( getClass().getResourceAsStream( PATH + name ) ); + String tidyPom = new PomTidy().tidy( pom ); + assertEquals( pom, tidyPom, "nothing to tidy here" ); + } } diff --git a/src/test/java/org/codehaus/mojo/tidy/task/PomTidyTest.java b/src/test/java/org/codehaus/mojo/tidy/task/PomTidyTest.java index 49cc219..78014e2 100644 --- a/src/test/java/org/codehaus/mojo/tidy/task/PomTidyTest.java +++ b/src/test/java/org/codehaus/mojo/tidy/task/PomTidyTest.java @@ -44,6 +44,7 @@ public static Iterable tests() "pom-with-reporting", "project-single-line" ); } + @SuppressWarnings( "checkstyle:VisibilityModifier" ) @Parameter( 0 ) public String name;