From 6959085ffe00784bbc5217c48ac55de7ac88a011 Mon Sep 17 00:00:00 2001 From: Dan Fox Date: Mon, 3 Feb 2020 13:40:04 +0000 Subject: [PATCH 1/3] Turn off ParenPad when p-j-f enabled --- .../palantir/baseline/plugins/BaselineConfig.java | 15 +++++++++------ .../baseline/BaselineConfigIntegrationTest.groovy | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) 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..192069aff 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,15 @@ 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 '' + } } } From 4f10844e2c596c940de2e33db83a8a20790a0dbe Mon Sep 17 00:00:00 2001 From: Dan Fox Date: Mon, 3 Feb 2020 13:45:48 +0000 Subject: [PATCH 2/3] format --- .../groovy/com/palantir/baseline/plugins/BaselineConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 192069aff..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 @@ -105,7 +105,8 @@ public void execute(Task task) { + " \n", "") .replace( - " \n", + " \n", ""); Preconditions.checkState(!contents.equals(replaced), "Patching checkstyle.xml must make a change"); Files.write(checkstyleXml, replaced.getBytes(StandardCharsets.UTF_8)); From 678af2e725c1d06bb0d00b43b6004ce50c18746b Mon Sep 17 00:00:00 2001 From: Dan Fox Date: Mon, 3 Feb 2020 13:45:48 +0000 Subject: [PATCH 3/3] Add generated changelog entries --- changelog/@unreleased/pr-1205.v2.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/@unreleased/pr-1205.v2.yml 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