[Geoserver-devel] Mass reformat, last check before proposal

Hi,
I have setup a few branches for people to check the mass reformat attempt using AOSP style
(and for GeoTools, also Google style).

Please take five minutes to review the Google style guide:
https://google.github.io/styleguide/javaguide.html

The AOSP format is like the Google one, but indents 4 spaces and has continuation indents at 8 spaces (while Google does 2 and 4 respectively).

And then check the branches (look at files that you edit often and are familiar with).

AOSP convention (has maven tools to format and enforce):

Google style convention (has maven tools to format and enforce):

I did setup a Doodle for people to express an opinion on the various options, please cast your votes (try to vote anything
you can stomach, not just your preferred option):

https://doodle.com/poll/gchp96ka93g5r7ek

I know formatting is a difficult topic, it has been causing troubles with pull request (we’re asking people to
follow rules that are not respected in the existing code) and indeed there is a number of files looking like s***t.
However, I’m doing this for the benefit of the project and don’t want to be flamed to a crisp two week down the
line because people did not care to check before.

If there is not enough participation to the Doodle or there is no reasonable agreement I’ll simply give up the attempt
and leave the code as is.

Cheers
Andrea

···

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

Thanks again, Andrea, for your massive effort. This is really great. I think the Google AOSP option does a good job and is the only one I could stomach. As you note, it also has automated tooling for reduced implementation effort. I have added my vote to the Doodle poll.

Perhaps you could send a separate email to draw attention to the poll? This poll is an important change and merits attention.

Some detailed observations on Google AOSP:

tl;dr: aggressive Javadoc reformatting, aggressive operator and argument line breaks, ignoring @formatter:off introduces some loss of indentation of hand-formatted inline XML (for example) as expected

For the convenience of readers, GitHub compare before/after (limited to 3000 files per diff):
https://github.com/aaime/geotools/compare/04c24bd...aaime:aosp_format
https://github.com/aaime/geowebcache/compare/e21ecaa...aaime:aosp_format
https://github.com/aaime/geoserver/compare/2d7d842...aaime:aosp_format

Javadocs are reformatted aggressively:
- One line javadocs with /** ... */ spread over three lines are converted to a single /** ... */ line
- Paragraphs in javadocs get a <p> tag
- Trailing closing tags like </li> are removed (making it HTML not XHTML)

The formatter introduces aggressive line breaks for multiple operators like "+" to concatenate strings. This is a good thing and makes my use of trailing "//" comments and later @formatter:off mostly redundant. The Google AOSP formatter seems much more keen than Eclipse to break long argument lists over multiple lines. This uses a lot of vertical space but improves legibility. I would have done this before but Eclipse formatting wore me down! You can see many of these changes in gs-app-schema-test FeatureChainingWfsTest:
https://github.com/aaime/geoserver/compare/2d7d842...aaime:aosp_format#diff-a6b0798578a6d274c63757511288f27eR649

Hand-indented concatenated strings (containing XML) protected with @formatter:off lose their indentation because @formatter:off is ignored, so nested elements become a flat list. Here is an example from gs-wps-core:
Before: https://github.com/aaime/geoserver/blob/7cd240f/src/extension/wps/wps-core/src/test/java/org/geoserver/wps/ExecuteTest.java#L203
After: https://github.com/aaime/geoserver/blob/aosp_format/src/extension/wps/wps-core/src/test/java/org/geoserver/wps/ExecuteTest.java#L207

Indentation internal to string literals is preserved and still looks fine. This example as before from gs-app-schema-test FeatureChainingWfsTest. I do not know if my trailing "//" comments help:
https://github.com/aaime/geoserver/compare/2d7d842...aaime:aosp_format#diff-a6b0798578a6d274c63757511288f27eR1506

This spot where I used @formatter:off to stop Eclipse from putting constants on the same line is just as good after Google AOSP with @formatter:off ignored! This is likely because of aggressive line breaking in Google AOSP:
Before: https://github.com/aaime/geotools/blob/04c24bdd0e26e2a8ce24423ce918cfca0130a027/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/AzimuthalEquidistant.java#L434
After: https://github.com/aaime/geotools/blob/53c981136892efd7f895c0e93fcc045e7637880e/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/AzimuthalEquidistant.java#L432

Grepping the code base for "@formatter" might help locate spots that need work. Trailing "//" comments and space internal to string literals might be an acceptable alternative.

Kind regards,
Ben.

On 25/03/18 22:20, Andrea Aime wrote:

Hi,
I have setup a few branches for people to check the mass reformat attempt
using AOSP style
(and for GeoTools, also Google style).

Please take five minutes to review the Google style guide:
https://google.github.io/styleguide/javaguide.html

The AOSP format is like the Google one, but indents 4 spaces and has
continuation indents at 8 spaces (while Google does 2 and 4 respectively).

And then check the branches (look at files that you edit often and are
familiar with).

AOSP convention (has maven tools to format and enforce):

    - https://github.com/aaime/geotools/tree/aosp_format
    - https://github.com/aaime/geoserver/tree/aosp_format
    - https://github.com/aaime/geowebcache/tree/aosp_format

Google style convention (has maven tools to format and enforce):

    - https://github.com/aaime/geotools/tree/google_format

Plain IntelliJ reformat (this one will have no support for build checks,
will rot over time, unless we invest a lot of time to do a manual
post-reformat that satisifies CheckStyle too):

    - https://github.com/aaime/geotools/tree/intellij_format

I did setup a Doodle for people to express an opinion on the various
options, please cast your votes (try to vote anything
you can stomach, not just your preferred option):
https://doodle.com/poll/gchp96ka93g5r7ek

I know formatting is a difficult topic, it has been causing troubles with
pull request (we're asking people to
follow rules that are not respected in the existing code) and indeed there
is a number of files looking like s***t.
However, I'm doing this for the benefit of the project and don't want to be
flamed to a crisp two week down the
line because people did not care to check before.

If there is not enough participation to the Doodle or there is no
reasonable agreement I'll simply give up the attempt
and leave the code as is.

Cheers
Andrea

==

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <https://transient.nz/&gt;
New Zealand

Thanks for investigation !

···

On 03/25/2018 10:20 AM, Andrea Aime wrote:

Hi,
I have setup a few branches for people to check the mass reformat attempt using AOSP style
(and for GeoTools, also Google style).

Please take five minutes to review the Google style guide:
https://google.github.io/styleguide/javaguide.html

The AOSP format is like the Google one, but indents 4 spaces and has continuation indents at 8 spaces (while Google does 2 and 4 respectively).

And then check the branches (look at files that you edit often and are familiar with).

AOSP convention (has maven tools to format and enforce):

Google style convention (has maven tools to format and enforce):

I did setup a Doodle for people to express an opinion on the various options, please cast your votes (try to vote anything
you can stomach, not just your preferred option):

https://doodle.com/poll/gchp96ka93g5r7ek

I know formatting is a difficult topic, it has been causing troubles with pull request (we’re asking people to
follow rules that are not respected in the existing code) and indeed there is a number of files looking like s***t.
However, I’m doing this for the benefit of the project and don’t want to be flamed to a crisp two week down the
line because people did not care to check before.

If there is not enough participation to the Doodle or there is no reasonable agreement I’ll simply give up the attempt
and leave the code as is.

Cheers
Andrea

==

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! [http://sdm.link/slashdot](http://sdm.link/slashdot)
_______________________________________________
Geoserver-devel mailing list
[Geoserver-devel@lists.sourceforge.net](mailto:Geoserver-devel@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-devel](https://lists.sourceforge.net/lists/listinfo/geoserver-devel)

-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit [http://goo.gl/it488V](http://goo.gl/it488V) for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

[http://www.geo-solutions.it](http://www.geo-solutions.it)
[http://twitter.com/geosolutions_it](http://twitter.com/geosolutions_it)

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
 
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

Hi Andrea,

I have no vote to cast. But I like the option to include some code
styling check on Travis. We do that in QGIS and it works. Maybe
checkstyle [1] is fine for our JAVA projects.

I can see that you and Ben are the ones managing the CI (thanks!). Are
you planning to include this code style enforcement on Travis? How it
would be? We could use the same script to do a local check on a pre
commit hook.

For personal usage, I've downloaded and installed AOSP code rules from
[2] for IntelliJ Idea and it seems to work.

Thank you for pushing for software quality,

Jorge Gustavo

[1] http://checkstyle.sourceforge.net/

[2]
https://raw.githubusercontent.com/aosp-mirror/platform_development/master/ide/intellij/codestyles/AndroidStyle.xml

On 25-03-2018 10:20, Andrea Aime wrote:

Hi,
I have setup a few branches for people to check the mass reformat
attempt using AOSP style
(and for GeoTools, also Google style).

Please take five minutes to review the Google style guide:
https://google.github.io/styleguide/javaguide.html

The AOSP format is like the Google one, but indents 4 spaces and has
continuation indents at 8 spaces (while Google does 2 and 4 respectively).

And then check the branches (look at files that you edit often and are
familiar with).

AOSP convention (has maven tools to format and enforce):

  * https://github.com/aaime/geotools/tree/aosp_format
  * https://github.com/aaime/geoserver/tree/aosp_format
  * https://github.com/aaime/geowebcache/tree/aosp_format

Google style convention (has maven tools to format and enforce):

  * https://github.com/aaime/geotools/tree/google_format

Plain IntelliJ reformat (this one will have no support for build checks,
will rot over time, unless we invest a lot of time to do a manual
post-reformat that satisifies CheckStyle too):

  * https://github.com/aaime/geotools/tree/intellij_format

I did setup a Doodle for people to express an opinion on the various
options, please cast your votes (try to vote anything
you can stomach, not just your preferred option):
https://doodle.com/poll/gchp96ka93g5r7ek

I know formatting is a difficult topic, it has been causing troubles
with pull request (we're asking people to
follow rules that are not respected in the existing code) and indeed
there is a number of files looking like s***t.
However, I'm doing this for the benefit of the project and don't want to
be flamed to a crisp two week down the
line because people did not care to check before.

If there is not enough participation to the Doodle or there is no
reasonable agreement I'll simply give up the attempt
and leave the code as is.

Cheers
Andrea

==

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio
stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti,
copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento
contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely
for the attention and use of the named addressee(s) and may be
confidential or proprietary in nature or covered by the provisions of
privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data
Protection Code).Any use not in accord with its purpose, any disclosure,
reproduction, copying, distribution, or either dissemination, either
whole or partial, is strictly forbidden except previous formal approval
of the named addressee(s). If you are not the intended recipient, please
contact immediately the sender by telephone, fax or e-mail and delete
the information in this message that has been received in error. The
sender does not give any warranty or accept liability as the content,
accuracy or completeness of sent messages and accepts no responsibility
for changes made after they were sent or for other risks which arise as
a result of e-mail transmission, viruses, etc.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

--
Geomaster, Lda
Avenida Barros e Soares, 423
Nogueira
4715-214 Braga
NIF 510906109
Tm +351 910333888
Email jgr@anonymised.com
Site geomaster.pt
GPS 41.53322,-8.41929

On Mon, Mar 26, 2018 at 1:21 PM, Jorge Gustavo Rocha <jgr@anonymised.com>
wrote:

Hi Andrea,

I have no vote to cast. But I like the option to include some code
styling check on Travis. We do that in QGIS and it works. Maybe
checkstyle [1] is fine for our JAVA projects.

Hi Jorge,
I've checked checkstyle and found it would require a massive amount of
manual changes.
Even after a full reformat made by IntelliJ, checkstyle found hundreds of
failures for
each single rule I've tried (basic ones!):

https://github.com/aaime/geotools/blob/intellij_checkstyle2/pom.xml#L1766

Long story short, having a different tool to do the reformat and to do the
checks
does not seem to work, or at the very least, it would, but would also
require
a significant up-front effort to make the codebase compliant (like, a week
worth
of code sprint with a few people).

I can see that you and Ben are the ones managing the CI (thanks!). Are
you planning to include this code style enforcement on Travis? How it
would be? We could use the same script to do a local check on a pre
commit hook.

The Google checker would run at every build, no matter what (it would break
your own
local build before you can make the pull request). If there is one good
thing about the Google
tooling, it is the performance of the tool, can check/reformat the whole
GeoTools codebase
in like 15-20 seconds (using a -T8 build).

For personal usage, I've downloaded and installed AOSP code rules from
[2] for IntelliJ Idea and it seems to work.

Nice

Cheers
Andrea

==

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

Hi Andrea,

Thanks again for pushing forward with the codebase reformat. While I would prefer Intellij + Checkstyle due to configurability, I entirely understand that it requires an unreasonable amount of effort given the current availability of people.

Given that, Google AOSP is tolerable, and certainly better than nothing. As noted earlier, I am still a bit concerned about how it handles long lines with trailing comments, but this is something that can be worked around (and doesn’t affect very many files anyways, although I am a bit concerned there is similar stuff hiding in the main reformat).

As an aside, a decent workaround for hand-indented XML (and similar) is to include the indentation inside the string. I imagine we’ll want to do similar stuff throughout the codebase to retain certain structures in a way that is compatible with the new formatting rules.

Torben

···

On Mon, Mar 26, 2018 at 5:18 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


Geoserver-devel mailing list
Geoserver-devel@anonymised.com.366…sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

On Mon, Mar 26, 2018 at 1:21 PM, Jorge Gustavo Rocha <jgr@anonymised.com> wrote:

Hi Andrea,

I have no vote to cast. But I like the option to include some code
styling check on Travis. We do that in QGIS and it works. Maybe
checkstyle [1] is fine for our JAVA projects.

Hi Jorge,
I’ve checked checkstyle and found it would require a massive amount of manual changes.
Even after a full reformat made by IntelliJ, checkstyle found hundreds of failures for
each single rule I’ve tried (basic ones!):

https://github.com/aaime/geotools/blob/intellij_checkstyle2/pom.xml#L1766

Long story short, having a different tool to do the reformat and to do the checks
does not seem to work, or at the very least, it would, but would also require
a significant up-front effort to make the codebase compliant (like, a week worth
of code sprint with a few people).

I can see that you and Ben are the ones managing the CI (thanks!). Are
you planning to include this code style enforcement on Travis? How it
would be? We could use the same script to do a local check on a pre
commit hook.

The Google checker would run at every build, no matter what (it would break your own
local build before you can make the pull request). If there is one good thing about the Google
tooling, it is the performance of the tool, can check/reformat the whole GeoTools codebase
in like 15-20 seconds (using a -T8 build).

For personal usage, I’ve downloaded and installed AOSP code rules from
[2] for IntelliJ Idea and it seems to work.

Nice

Cheers
Andrea

==

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

On Mon, Mar 26, 2018 at 6:50 PM, Torben Barsballe <
tbarsballe@anonymised.com> wrote:

Thanks again for pushing forward with the codebase reformat. While I would
prefer Intellij + Checkstyle due to configurability, I entirely understand
that it requires an unreasonable amount of effort given the current
availability of people.

Yeah, I am in a agreement, would have the same preference if it was not for
the effort. Thinking out loud, if we had that much resource, I'd rather use
them for something else (like library upgrades, working on Java 10
compatibility or something like that).

As an aside, a decent workaround for hand-indented XML (and similar) is to
include the indentation inside the string. I imagine we'll want to do
similar stuff throughout the codebase to retain certain structures in a way
that is compatible with the new formatting rules.

Thinking out loud, maybe we should just make it easier to use external XML
resources (an easy to use loader that also prints the XML on the console
for reference while coding).

Cheers
Andrea

==
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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

On Mon, Mar 26, 2018 at 9:55 AM, Andrea Aime <andrea.aime@anonymised.com>
wrote:

On Mon, Mar 26, 2018 at 6:50 PM, Torben Barsballe <
tbarsballe@anonymised.com> wrote:

Thanks again for pushing forward with the codebase reformat. While I
would prefer Intellij + Checkstyle due to configurability, I entirely
understand that it requires an unreasonable amount of effort given the
current availability of people.

Yeah, I am in a agreement, would have the same preference if it was not
for the effort. Thinking out loud, if we had that much resource, I'd rather
use them for something else (like library upgrades, working on Java 10
compatibility or something like that).

Yep, unfortunately reformatting is pretty low in priority when it comes to
important things that need a lot of developer effort. I agree that those
things would take priority if we had the developer availability for
implementing checkstyle.

As an aside, a decent workaround for hand-indented XML (and similar) is to

include the indentation inside the string. I imagine we'll want to do
similar stuff throughout the codebase to retain certain structures in a way
that is compatible with the new formatting rules.

Thinking out loud, maybe we should just make it easier to use external XML
resources (an easy to use loader that also prints the XML on the console
for reference while coding).

Adding external XML resources isn't really that difficult, but for small

snippets (e.g. for 7 lines or less I don't think an external resource is
ever going to be easier) or XML blocks that are largely the same with minor
changes it can be more convenient to have them in the same file/method as
the test (Given that, a simple utility for easily modifying specific
elements might be worthwhile. There's plenty of ways to do that already,
but most of them tend to be convoluted enough that it is usually easer to
just make another file right now).

Probably the biggest barrier to changing anything about how we handle XML
resources is that whenever a new XML test / snippet / whatever is added, it
is generally copied from an existing test case, so for any improvement to
gain traction it will need to be widely used. Certainly something to think
about though.

Torben

Cheers
Andrea

==
GeoServer Professional Services from the experts! Visit
GeoSolutions Enterprise Support Services for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
<Google Maps;
55054 Massarosa
<Google Maps;
(LU)
phone: +39 0584 962313 <+39%200584%20962313>
fax: +39 0584 1660272 <+39%200584%20166%200272>
mob: +39 339 8844549 <+39%20339%20884%204549>

http://www.geo-solutions.it
x.com

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

Hi Andrea,

Thanks for the effort. My thinking is that a global reformat is badly needed one way or the other. My preference is for the AOSP with automated checking, but barring that I am also happy with at a minimum a one time full reformat. Barring that, I also voted for one time reformats.

Cheers,
Devon

···

On Mon, Mar 26, 2018 at 12:13 PM, Torben Barsballe <tbarsballe@anonymised.com> wrote:


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


Geoserver-devel mailing list
Geoserver-devel@anonymised.com.366…sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

On Mon, Mar 26, 2018 at 9:55 AM, Andrea Aime <andrea.aime@anonymised.com…> wrote:

Yep, unfortunately reformatting is pretty low in priority when it comes to important things that need a lot of developer effort. I agree that those things would take priority if we had the developer availability for implementing checkstyle.

Adding external XML resources isn’t really that difficult, but for small snippets (e.g. for 7 lines or less I don’t think an external resource is ever going to be easier) or XML blocks that are largely the same with minor changes it can be more convenient to have them in the same file/method as the test (Given that, a simple utility for easily modifying specific elements might be worthwhile. There’s plenty of ways to do that already, but most of them tend to be convoluted enough that it is usually easer to just make another file right now).

Probably the biggest barrier to changing anything about how we handle XML resources is that whenever a new XML test / snippet / whatever is added, it is generally copied from an existing test case, so for any improvement to gain traction it will need to be widely used. Certainly something to think about though.

Torben

On Mon, Mar 26, 2018 at 6:50 PM, Torben Barsballe <tbarsballe@anonymised.com> wrote:

Thanks again for pushing forward with the codebase reformat. While I would prefer Intellij + Checkstyle due to configurability, I entirely understand that it requires an unreasonable amount of effort given the current availability of people.

Yeah, I am in a agreement, would have the same preference if it was not for the effort. Thinking out loud, if we had that much resource, I’d rather use them for something else (like library upgrades, working on Java 10 compatibility or something like that).

As an aside, a decent workaround for hand-indented XML (and similar) is to include the indentation inside the string. I imagine we’ll want to do similar stuff throughout the codebase to retain certain structures in a way that is compatible with the new formatting rules.

Thinking out loud, maybe we should just make it easier to use external XML resources (an easy to use loader that also prints the XML on the console for reference while coding).

Cheers

Andrea

==
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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.