Black outputs CRLF line endings on Windows even if the source file has Unix-style lines. It's possible to work around using for example Git configuration, but it would be nice if the behavior was configurable. Some of us like to keep Unix line endings even on Windows.
Not exactly the same thing but it sounds like that.
Thanks, that's exactly the bug I'm noticing! default_line_ending is a Sublime setting no? So not exactly the right solution but fixing this bug should also fix that one.
@ambv I know that you don't want to support config files and extra options but consider supporting end_of_line and insert_final_newline rules from editorconfig with https://pypi.org/project/EditorConfig/ help.
Hm. I think what Black should do here is to retain existing line endings. That doesn't require any configuration.
@zsol, I will assign this to you as you have opportunity to test this on Windows.
@ambv there are projects that have a mix of windows and unix line endings even in a single file so if you picked such a project you won't be able to make it consistent with only black run, you will need to run all files through some tool that will convert line endings across the project, it's not hard to do but inconvenient.
black brands itself as uncompromising and opinionated. Perhaps it would be simpler to always choose Unix-style line endings for a consistent output. I recently started working on a project with Windows line endings and noticed black had no opinion on them.
Most helpful comment
black brands itself as uncompromising and opinionated. Perhaps it would be simpler to always choose Unix-style line endings for a consistent output. I recently started working on a project with Windows line endings and noticed black had no opinion on them.