You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you import a project which uses the palantir-java-format Gradle plugin in IntelliJ, it asks you to install the palantir-java-format IntelliJ plugin. However, as external (non-Palantir) contributor you might not want to do this, for example because you just want to make one small change and because you are not familiar with that IntelliJ plugin and whether it disrupts your other work.
Instead you might just want to run one formatting command (Spotless?) once you are done, before committing your changes.
The problem is that the palantir-java-format Gradle plugin on build modifies the IntelliJ project configuration:
That by itself might already be a bit questionable, but what is worse is that this happens even if you don't have the palantir-java-format IntelliJ plugin installed. This makes IntelliJ format the code based on its own formatting configuration, causing large diffs in the worst case. And the Gradle plugin keeps enabling the auto-formatting every Gradle build, even if you disable it again in the IntelliJ settings. For you as user this feels like you are constantly fighting IntelliJ's auto-formatting until you notice that the palantir-java-format Gradle plugin keeps enabling it.
I assume you can imagine what a horrible experience this is for external contributors.
So please, if this Gradle plugin really needs to make changes to the IntelliJ project config, consider doing this only if the user has the IntelliJ plugin installed.
How to reproduce
Make sure you don't have palantir-java-format IntelliJ plugin installed yet
Background: palantir/javapoet#86
Related to #1111
Description
When you import a project which uses the palantir-java-format Gradle plugin in IntelliJ, it asks you to install the palantir-java-format IntelliJ plugin. However, as external (non-Palantir) contributor you might not want to do this, for example because you just want to make one small change and because you are not familiar with that IntelliJ plugin and whether it disrupts your other work.
Instead you might just want to run one formatting command (Spotless?) once you are done, before committing your changes.
The problem is that the palantir-java-format Gradle plugin on build modifies the IntelliJ project configuration:
palantir-java-format/gradle-palantir-java-format/src/main/groovy/com/palantir/javaformat/gradle/PalantirJavaFormatIdeaPlugin.java
Lines 90 to 94 in 428c6fe
That by itself might already be a bit questionable, but what is worse is that this happens even if you don't have the palantir-java-format IntelliJ plugin installed. This makes IntelliJ format the code based on its own formatting configuration, causing large diffs in the worst case. And the Gradle plugin keeps enabling the auto-formatting every Gradle build, even if you disable it again in the IntelliJ settings. For you as user this feels like you are constantly fighting IntelliJ's auto-formatting until you notice that the palantir-java-format Gradle plugin keeps enabling it.
I assume you can imagine what a horrible experience this is for external contributors.
So please, if this Gradle plugin really needs to make changes to the IntelliJ project config, consider doing this only if the user has the IntelliJ plugin installed.
How to reproduce
.java
source files, for exampleCodeBlock.java
❌ Issue: Notice how it reformatted the file, in a way not compatible with the Palantir formatting
❌ Issue: Notice how "Reformat code" and "Optimize imports" were automatically enabled
❌ Issue: Notice how the settings "Reformat code" and "Optimize imports" were automatically enabled again
The text was updated successfully, but these errors were encountered: