palantir / javapoet

Java library used to generate Java source files.
Apache License 2.0
7 stars 5 forks source link

[Meta] Gradle build script enables IntelliJ "Reformat code" on save? #86

Open Marcono1234 opened 1 week ago

Marcono1234 commented 1 week ago

What happened?

It seems somehow the Gradle build script of this project enable IntelliJ "Actions on save" > "Reformat code" (please correct me if I am wrong and something else is enabling this), and even keeps re-enabling it after you disable it.

IntelliJ warned me that "Required plugins have not been loaded" ('CheckStyle-IDEA' and 'palantir-java-format') when I loaded the project. But I chose not to install these plugins because I was hoping to to only make smaller changes, and be able to fix all formatting violations using a Gradle task, not having to get familiar with two additional IntelliJ plugins.

Maybe because I don't have these plugins installed, when IntelliJ now automatically formats the code (which as mentioned above, I cannot disable permanently) it introduces large amounts of whitespace changes. And this unfortunately often before I was able to commit my changes. So currently it feels like I am constantly fighting IntelliJ / the Gradle build script to not mess with the formatting.

What did you want to happen?

Not completely sure, but I find the current setup a bit intrusive, and the reformatting interferes with making changes (e.g. you get a massive whitespace diff on commit).

I was rather hoping that I did not have to install these IntelliJ plugins for smaller changes, and if necessary the Gradle build would inform me about formatting violations, and ideally there was a task which I could run to fix them.

So that I could make all my changes (without having to pay close attention to formatting, or IntelliJ auto-formatting the code), and then in the end run a Gradle build and fix formatting violations.

Though maybe the Gradle build script is really more suited for Palantir members, who already have these IntelliJ plugins installed, and for whom all of this is normal and familiar?

Marcono1234 commented 1 week ago

Probably relates to https://github.com/palantir/palantir-java-format/issues/1111