diffplug / spotless

Keep your code spotless
Apache License 2.0
4.48k stars 454 forks source link

Add option to normalize line ending prior checking or ignore during check #2277

Open kwin opened 5 days ago

kwin commented 5 days ago

Currently the lineEndings option does only allow to configure which line endings to expect. There is no single option which works on non-Git based source code (i.e. extracted from a ZIP source archive) accepting both line endings (Windows and Unix).

This is crucial though because by default source archives created with maven-source-plugin are not normalized with respect to line endings, i.e. the archives end up with Windows endings on a Windows machine and Unix endings on all other machines. As the spotless configuration is part of the source archive, building should not fail with spotless errors irrespective of the line ending.

nedtwigg commented 4 days ago

the archives end up with Windows endings on a Windows machine and Unix endings on all other machines

PLATFORM_NATIVE should work here, yeah?

kwin commented 3 days ago

No, you have arbitrary line endings in the source and it should work with the same config to do spotless:check in Windows and Unix machines. PLATFORM_NATIVE only works if source was created with the same platform, but not if created on a platform with another line ending.