diff --git a/changelog/@unreleased/pr-1205.v2.yml b/changelog/@unreleased/pr-1205.v2.yml new file mode 100644 index 000000000..92c905cb7 --- /dev/null +++ b/changelog/@unreleased/pr-1205.v2.yml @@ -0,0 +1,6 @@ +type: fix +fix: + description: Checkstyle's `ParenPad` rule is turned off when using palantir-java-format, + to avoid disagreements that can't be fixed by the user. + links: + - https://github.com/palantir/gradle-baseline/pull/1205 diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java index b44ab31c4..4585935bc 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java @@ -98,12 +98,16 @@ public void execute(Task task) { try { String contents = new String(Files.readAllBytes(checkstyleXml), StandardCharsets.UTF_8); String replaced = contents.replace( - " " - + "\n" - + " \n" - + " \n" - + " \n", - ""); + " " + + "\n" + + " \n" + + " \n" + + " \n", + "") + .replace( + " \n", + ""); Preconditions.checkState(!contents.equals(replaced), "Patching checkstyle.xml must make a change"); Files.write(checkstyleXml, replaced.getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { diff --git a/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineConfigIntegrationTest.groovy b/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineConfigIntegrationTest.groovy index 439cd9611..d0de6364a 100644 --- a/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineConfigIntegrationTest.groovy +++ b/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineConfigIntegrationTest.groovy @@ -149,5 +149,8 @@ class BaselineConfigIntegrationTest extends AbstractPluginTest { !new File(projectDir, '.baseline/checkstyle/checkstyle.xml').readLines().any { it.contains '' } + !new File(projectDir, '.baseline/checkstyle/checkstyle.xml').readLines().any { + it.contains '' + } } }