diffplug / diffplug/spotless

no ability to specifiy default fallback line ending for a repo with core.autocrlf=false

Open
#1,559 3 comments 0 reactions 0 assignees View on GitHub
bug-unconfirmed
Dominant language
Java
Stars
5.6k
Forks
559
Avg merge
1d 13h
Merged PRs (30d)
34

Description

with spotless and a cross platform repository it is not easily possible to enable spotless for all (windows) users.

if a Windows user has `core.autocrlf=false` to disable line end conversion so they end up with exactly what the repository has, then spotless falls back to assuming that `\r\n` should be used (which is incorrect in this case).

you can force `\n` on everyone by adding a `.gitattributes` to the repository but this will impact windows users whose default tooling may not cope well with linux line ends.

in other words - [this fallback](https://github.com/diffplug/spotless/blob/05b87790807c8e8f5f2a0623388492da3bc5d748/lib-extra/src/main/java/com/diffplug/spotless/extra/GitAttributesLineEndings.java#LL288C3-L288C3) should not fallback to `native` but a configurable option in spotbugs (ie Unix if not changed by local git config).

If you are submitting a **bug**, please include the following:

Maven 3.8.6
Java 11.0.15
Windows 11

```

com.diffplug.spotless
spotless-maven-plugin
2.31.0



check





AOSP



true






UTF-8
\n
false
true
scope,groupId,artifactId
groupId,artifactId
groupId,artifactId
true
true





```

- [x] summary of problem
- [x] gradle or maven version
- [x] spotless version
- [x] operating system and version
- [] copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
- [ ] copy-paste the full content of any console errors emitted by `gradlew spotless[Apply/Check] --stacktrace`

If you're just submitting a feature request or question, no need for the above.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.