Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] auto-formatting source code ?

With spotless-maven-plugin, you can

- use google-java-format or eclipse formatter, maintainer's choice
- optionally use "ratchetFrom origin/main" so that the autoformatting only happens on changed files, to avoid a giant "format everything" commit

I actually started Spotless many years ago because of a frustrating experience getting a PR merged into JGit, lol. Just a quick plug since I was on the mailing list, I'm terrible with maven and I don't know much about JGit's build.

Ned Twigg
Lead Software Engineer, DiffPlug LLC
949-264-3433
540-336-8043 (cell)
447 Sutter St Ste 405, San Francisco, CA 94108


On Tue, May 14, 2024 at 10:51 AM Thomas Wolf via jgit-dev <jgit-dev@xxxxxxxxxxx> wrote:
On 14.05.24 14:31 , Matthias Sohn via jgit-dev wrote:
> Hence I propose we adopt the approach the Gerrit project is using and
> switch from Eclipse auto-formatter to google-java-format [1] and add a
> Gerrit submit rule and a label "CodeStyle" which the CI can vote on to
> block changes which weren't properly auto-formatted using
> google-java-format.
>
> WDYT ?
>
> [1] https://github.com/google/google-java-format
> <https://github.com/google/google-java-format>

Don't care much *if* the google-java-format works seamlessly in
Eclipse. Switching away from the Eclipse formatter to something else
simply inverts the burden: currently non-Eclipse users would have to
configure their IDEs to use the Eclipse formatter (which _is_ possible
at least in IntelliJ), in the future, Eclipse users would have to do
so.

IMO, much more important than formatting would be to run the Eclipse
PDE API checks during the normal build at least on Jenkins, and fail
the build if there are any problems. (Wrong @since, non-API types
used in API methods, breaking API, etc.)

Cheers,

   Thomas

_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jgit-dev

Back to the top