WhatsApp / erlfmt

An automated code formatter for Erlang
Apache License 2.0
412 stars 52 forks source link

Line endings on Windows #328

Open lukebakken opened 2 years ago

lukebakken commented 2 years ago

Thanks for the very useful project!

I opened the following pull request (which may or may not be accepted) to use erlfmt on a new RabbitMQ project - https://github.com/rabbitmq/khepri/pull/28

I have the following git settings related to line endings in my Win 10 dev environment:

[core]
    autocrlf = true
    eol = native
    safecrlf = warn

This means that files in my clone of rabbitmq/khepri have CRLF endings, but LF endings in the repo.

When I run rebar3 fmt it converts all of the files to LF endings, even if no other formatting needed to happen. In addition, rebar3 fmt --check also thinks CRLF endings indicate mis-formatted files (https://github.com/rabbitmq/khepri/runs/4632960535?check_suite_focus=true)

This isn't the end of the world, because I can force LF endings via the .gitattributes file -

https://github.com/rabbitmq/khepri/blob/lukebakken/erlfmt/.gitattributes

...but it would be nice if erlfmt were forgiving when it comes to line endings, either by default or via configuration.

Merry Christmas 🎄