Hi,

Right now our Spotless configuration just specifies the lines endings,
forbids tabs and sorts the imports. If we want to apply some
OpenRewrite rule to the codebase (e.g. migrate all string
concatenations to parameterized logging or migrate JUnit4 to Junit5),
we need a deterministic formatter to clean up the mess OpenRewrite
leaves behind.

On my personal projects I've bee playing with Google Java format[1]
for some time and it basically corresponds to what we already use
except:

 * it has a non-configurable indentation of 2 spaces.

There is also a Palantir Java format[2], which is as far as I can tell
also non-configurable (which is a feature, not a problem). Both have
maintained Eclipse and IntelliJ plugins.

On the other hand of the spectrum there is an Eclipse formatter, which
is fully configurable and apparently has an IntelliJ plugin[3]. This
is the one I used at my dayjob, but it lead to months of discussions,
complains about the settings and a list of trick and tips on how to
change the formatting with comments. We also had a minor problem with
import sorting:

 * the formatter does not sort imports, so we used Spotless to do it.
However Spotless and the Eclipse IDE use a different collation, which
generated some conflicts.

What do you think about enforcing a deterministic formatter on our code?

Piotr

[1] https://github.com/google/google-java-format
[2] https://github.com/palantir/palantir-java-format
[3] https://plugins.jetbrains.com/plugin/6546-adapter-for-eclipse-code-formatter

Reply via email to