Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize on 2 * indent as the continuation indent #414

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion maven-plugin/src/it/four-spaces-indent/expected_pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sortpom:sort
User property: sort.indentSchemaLocation
Should the schema location attribute of project (top level xml element)
be placed on a new line. The attribute will be indented (2 *
nrOfIndentSpace + 1 space) characters.
nrOfIndentSpace) characters.

keepBlankLines (Default: true)
User property: sort.keepBlankLines
Expand Down Expand Up @@ -203,7 +203,7 @@ sortpom:verify
User property: sort.indentSchemaLocation
Should the schema location attribute of project (top level xml element)
be placed on a new line. The attribute will be indented (2 *
nrOfIndentSpace + 1 space) characters.
nrOfIndentSpace) characters.

keepBlankLines (Default: true)
User property: sort.keepBlankLines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ abstract class AbstractParentMojo extends AbstractMojo {

/**
* Should the schema location attribute of project (top level xml element) be placed on a new
* line. The attribute will be indented (2 * nrOfIndentSpace + 1 space) characters.
* line. The attribute will be indented (2 * nrOfIndentSpace) characters.
*/
@Parameter(property = "sort.indentSchemaLocation", defaultValue = "false")
boolean indentSchemaLocation;
Expand Down
3 changes: 2 additions & 1 deletion sorter/src/main/java/sortpom/output/PatchedXMLWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ protected void writeAttribute(Attribute attribute) throws IOException {
writePrintln();
writeString(format.getIndent());
writeString(format.getIndent());
} else {
writer.write(" ");
}
writer.write(" ");
writer.write(qualifiedName);
writer.write("=");

Expand Down
4 changes: 2 additions & 2 deletions sorter/src/test/java/sortpom/sort/IndentationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void indentSchemaLocationShouldAddNewlineAndIndentation(int indent) {
+ lineSeparator
+ indentChars
+ indentChars
+ " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd\">"
+ "xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd\">"
+ lineSeparator
+ indentChars
+ "<Gurka xmlns=\"\"></Gurka>"
Expand Down Expand Up @@ -106,7 +106,7 @@ void otherAttributeShouldNotBeIndented() {
+ lineSeparator
+ indentChars
+ indentChars
+ " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd\">"
+ "xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd\">"
+ lineSeparator
+ indentChars
+ "<Gurka xmlns=\"\" key=\"value\"></Gurka>"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sortpom</groupId>
<artifactId>sortpom</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sortpom</groupId>
<artifactId>sortpom</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sortpom</groupId>
<artifactId>sortpom</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sortpom</groupId>
<artifactId>sortpom</artifactId>
Expand Down