-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to preserve line ending during check/formatting #2277
Comments
PLATFORM_NATIVE should work here, yeah? |
No, you have arbitrary line endings in the source and it should work with the same config to do |
I'm open to a spotless/lib/src/main/java/com/diffplug/spotless/LineEnding.java Lines 45 to 50 in b2a2cbb
spotless/lib/src/main/java/com/diffplug/spotless/LineEnding.java Lines 134 to 136 in b2a2cbb
Two ambiguous cases:
My vote is that both these cases round to "UNIX", but print a warning message. |
I agree with all you said except for the case
In this case I would just throw an exception. This is IMHO never acceptable. However for performance reasons I would probably just check for the first line ending in a file (and not check all) therefore the first line ending in a file determines the outcome. |
This is required to run spotless:check on top of extracted source archives (outside Git repositories). Compare with apache/maven-parent#205 and diffplug/spotless#2277.
This is required to run spotless:check on top of extracted source archives (outside Git repositories). Compare with apache/maven-parent#205 and diffplug/spotless#2277.
Accept all line endings (even outside git repositories), compare with diffplug/spotless#2277 This closes #205
compare with diffplug/spotless#2277 Update to spotless-m-p 2.44.0.BETA4 This closes #205
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.
The text was updated successfully, but these errors were encountered: