Hi all,
you probably know that we are formatting the source code with the Spotless Maven plugin,
in combination with the Google Java Format library.
Currently, we are using an older version of both, because they upgraded time ago to require Java 11 as the minimum version, and we were still using Java 8. But we have been on Java 11 for a while now, and we can update up the dependencies.
I’ve prepared a pure upgrade of GeoTools, as an example, here:
https://github.com/aaime/geotools/tree/spotless_upgrade
The update touches 2k files, mostly changing the javadoc style for single line javadocs, to use three lines instead. Lots of noise, no significant gain in my opinion.
One formatting library that I’ve been keeping an eye on for a while is Palantir’s fork of Google Java format. They made some significant changes:
-
4 spaces indent by default (we get this by adopting the AOSP style of Google’s one)
-
120 columns rather than 100
-
Formatter optimized for streams and functional style to use less space.
They have some significant examples in their landing page. I’ve tried this out with GeoTools, and linking what I’ve found, also with GeoServer (both are best viewed offline, in a checkout):
In this case, the GeoTools diff is significantly bigger than the pure Spotless upgrade, touches 2k files, but in the end, manages to cut down 60k lines of code.
What is your opinion? Would you like to go with Palantir?
If we went down that road, I’d recommend to:
- Wait until the Wicket 9 upgrade is done
- Wholesale reformat all three projects (GeoTools, GeoWebCache, GeoServer)
- Reformat all active branches for ease of backport (if this ends up landing after the 2.25.x release, maybe also reformat the 2.23.x series as it will likely get some extra fixes in the next few months).
Cheers
Andrea
···
GeoServer Professional Services from the experts!
Visit http://bit.ly/gs-services-us for more information.
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions Group
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
https://www.geosolutionsgroup.com/
http://twitter.com/geosolutions_it
Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail