[Geoserver-devel] Spotless formatting landed on all active branches

Hi all,
quick heads up, the Java code formatting has been switched to Spotless, along with the latest
java-code-format version available for Java 8 (there are newer versions, they require Java 11).

Not much changed for you, the new version of java-code-format formats lamba in a slightly
more compact way, and indents annotations spanning multiple lines a little more.
It’s still getting executed while you do a “mvn clean install” (which you do every time before
pushing a PR, right?.. right???).

If you want to manually format code, the command is now “mvn spotless apply”.

Spotless keeps a bunch of .spotless-index files around the modules, to track which files
have been modified and need to be reformatted. They are in .gitignore, so no chance
of committing them, but if you switch to an older branch that does not have the
updated .gitattributes, they will show up as “new files”. Just in case, you know where they
are coming from.

Cheers
Andrea

Thank you very much Andrea:

I like to set up my IDE to follow the code formatting convention; any tips / integrations to consider: )

Jody

···


Jody Garnett

Hey,
heads up to all using Windows… it seems that doing simply a “git reset --hard” is not upgrading
the existing checkouts. However, a fresh checkout will work fine (that’s what Brad tried, I also did not, works).
The result on a old checkout is that Spotless finds files with wrong line endings and reformats them…

Anyone knows how to perform a true cleanup? I’m coming out empty, so far getting a fresh clone
seems to be the only approach working

Cheers
Andrea

On Sat, Feb 12, 2022 at 5:40 PM Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi all,
quick heads up, the Java code formatting has been switched to Spotless, along with the latest
java-code-format version available for Java 8 (there are newer versions, they require Java 11).

Not much changed for you, the new version of java-code-format formats lamba in a slightly
more compact way, and indents annotations spanning multiple lines a little more.
It’s still getting executed while you do a “mvn clean install” (which you do every time before
pushing a PR, right?.. right???).

If you want to manually format code, the command is now “mvn spotless apply”.

Spotless keeps a bunch of .spotless-index files around the modules, to track which files
have been modified and need to be reformatted. They are in .gitignore, so no chance
of committing them, but if you switch to an older branch that does not have the
updated .gitattributes, they will show up as “new files”. Just in case, you know where they
are coming from.

Cheers
Andrea