Skip to content
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

CRLF will be converted to LF when submitting documents #1171

Closed
6 tasks
magestacks opened this issue Apr 19, 2022 · 1 comment
Closed
6 tasks

CRLF will be converted to LF when submitting documents #1171

magestacks opened this issue Apr 19, 2022 · 1 comment

Comments

@magestacks
Copy link

Hello, I encountered the problem of transferring CRLF to LF when using spotless. The details are as follows

  • summary of problem
    CRLF will be converted to LF when submitting documents.

image

  • gradle or maven version
    apache-maven-3.5.4

  • spotless version
    2.21.0

  • operating system and version
    image

  • copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible

<plugin>
    <groupId>com.diffplug.spotless</groupId>
    <artifactId>spotless-maven-plugin</artifactId>
    <version>2.22.1</version>
    <configuration>
        <java>
            <includes>
                <include>src/test/java/**/*.java</include>
            </includes>
            <eclipse>
                <file>${session.executionRootDirectory}/dev-support/shardingsphere_eclipse_formatter.xml
                </file>
            </eclipse>
            <licenseHeader>
                <file>${session.executionRootDirectory}/dev-support/license-header</file>
            </licenseHeader>
        </java>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>apply</goal>
            </goals>
            <phase>compile</phase>
        </execution>
    </executions>
</plugin>
  • copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace
    ignore
@nedtwigg
Copy link
Member

I believe this is the expected behavior. https://github.com/diffplug/spotless/tree/main/plugin-maven#line-endings-and-encodings-invisible-stuff

If you want all files to be \r\n I would add a .gitattributes file with * text eol=crlf. If it's just certain files then I would adjust the wildcard appropriately.

Another option is to set <lineEndings>WINDOWS</lineEndings> but you will be fighting against git if you do that, which I don't recommend.

Perhaps you wish that Spotless detected the line endings per-file, and just kept them as-is? We don't support that right now, but I'd be happy merge that as a new line endings mode (#1172).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants