[Geoserver-devel] status of [GEOS-9883] Add pom.xml formatting + formatting QA check

Hi all,
A couple of weeks ago I opened [1][2] to add formatting of sets of xml documents (pom files and application config files) as part of the Q&A.

Especially the pom files are a mess of tab and space indents and trailing white space.

I've only had some feedback from Andrea until now [3]. The PR has gone stale, but I can recreate if this is something we all want.

I would like to wrap this PR up either by recreating and merging or just closing it and leaving things as they are.

Mark

[1] https://osgeo-org.atlassian.net/browse/GEOS-9883
[2] https://github.com/geoserver/geoserver/pull/4663
[3] https://sourceforge.net/p/geoserver/mailman/geoserver-devel/thread/42ffe725-4daf-0796-4113-7744aa884e96%40gmail.com/#msg37199837

Hi Mark,

I’d like to try out using the Eclipse formatter, to see if we can retain empty lines, first.
I’ve been too busy with the PMD tests checks and the other PRs for varargs/lambdas
lately, and hope to be able to try out the Eclipse formatter maven plugin by the beginning of March.

Cheers
Andrea

···

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it 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.

OK,
I'll wait and see how that turns out.
thanks.

On 18-02-2021 14:19, Andrea Aime wrote:

Hi Mark,
I'd like to try out using the Eclipse formatter, to see if we can retain empty lines, first.
I've been too busy with the PMD tests checks and the other PRs for varargs/lambdas
lately, and hope to be able to try out the Eclipse formatter maven plugin by the beginning of March.

Cheers
Andrea

On Thu, Feb 18, 2021 at 1:19 PM Mark Prins <mc.prins@anonymised.com <mailto:mc.prins@anonymised.com>> wrote:

    Hi all,
    A couple of weeks ago I opened [1][2] to add formatting of sets of xml
    documents (pom files and application config files) as part of the Q&A.

    Especially the pom files are a mess of tab and space indents and
    trailing white space.

    I've only had some feedback from Andrea until now [3]. The PR has gone
    stale, but I can recreate if this is something we all want.

    I would like to wrap this PR up either by recreating and merging or
    just
    closing it and leaving things as they are.

    Mark

    [1] https://osgeo-org.atlassian.net/browse/GEOS-9883
    [2] https://github.com/geoserver/geoserver/pull/4663
    [3]
    https://sourceforge.net/p/geoserver/mailman/geoserver-devel/thread/42ffe725-4daf-0796-4113-7744aa884e96%40gmail.com/#msg37199837

    _______________________________________________
    Geoserver-devel mailing list
    Geoserver-devel@lists.sourceforge.net
    <mailto:Geoserver-devel@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it 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./

Hi all,

so I have the eclipse xml formatter a try… documentation was not always helpful, but managed to get it going,
result is here (you might want to check it out to analyze results, GitHub is having troubles with the large set of modified files):
https://github.com/geoserver/geoserver/pull/4800

Observations:

  • Preserves empty lines

  • Simple configuration file: https://github.com/geoserver/geoserver/pull/4800/files#diff-f6498acc0e4c272ca0cb3b54f073d4b545635e4c3d27b01c84add6b3acaa28caR1

  • Integrates in the build like the google-java one

  • Can be run in formar or validate mode
    Issues:

  • I could not find documentation for the config file format (but it’s really easy)

  • The plugin can be run stand-alone, using “mvn formatter:format”, but won’t find the configuration file because apparently the plugin setting the geoserverBaseDir is not run. I could not find a way to make it work yet… this is pretty darn annoying IMHO.

  • The github workflow integration is only partial (my fault, gotta go cook lunch now!)
    Questions:

  • I’ve tentatively set the intent to 4 spaces… pom files seemed to have more like 2 spaces indent, the Spring app context files were a bit all over the place. What shall we do?

  • Is there any other set of XML files we want to format, besides the pom files and the Spring app context ones?

Anyways, feedback welcomed!

Cheers
Andrea

···

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it 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.

So, trying to format pom.xml files with the revelc plugin does not seem to be an option (unless something new pops up),

but having an interesting discussion in a issue where I thought it was a thread safety issue (and well it is, just not the way I imagined it):
https://github.com/revelc/formatter-maven-plugin/issues/433

They pointed me at the “sortpom” plugin, which is designed to clean up pom files, but at the same
time keep comments and the like: https://github.com/Ekryd/sortpom

Going to give it a try (and eventually we could keep revelc for the spring application context, and other xml files
we’d like to format).

Cheers
Andrea

···

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it 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.

Hi all,

I’m still stuck on the eclipse formatter, it won’t work on a parallel build, not even trying for format only
application context files. The discussion with the plugin authors continues: https://github.com/revelc/formatter-maven-plugin/issues/433

In the meantime, I’ve opened a new PR to format just the pom.xml files using the sortPom plugin.
It "just works"™, loving the output (some hand tweaks could make it even better I believe, but as far as automatic formatting goes, it’s great IMHO).
Results here:
https://github.com/geoserver/geoserver/pull/4867

The changes in the pom files can be minimal (see wms/pom.xml) or a revolution in the order of elements (the main pom… liking the new order better honestly).
Feedback welcomed.

Cheers
Andrea

···

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it 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.

I also like the new order by sortPom plugin; the biggest thing is a consistent order making it easier to quickly find what you are looking for.

···


Jody Garnett

In the meantime, I’ve been pointed at yet another formatting plugin that can do XML, Spotless:

https://github.com/diffplug/spotless/tree/main/plugin-maven

Kind of interesting, also because it can run in combo also the Google Java Formatter.
More about the library used by the maven plugin here:
https://github.com/diffplug/spotless

Seems worth looking into

Cheers
Andrea

···

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it 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.