pre-commit / pre-commit-hooks

Some out-of-the-box hooks for pre-commit
MIT License
5.2k stars 694 forks source link

end-of-file-fixer doesn't work correctly with CRLF endings #1078

Closed edobez closed 1 month ago

edobez commented 1 month ago

end-of-file-fixer adds a LF before the last empty line, regardless of what are the EOL of the file. On Windows, where typical EOL are CRFL, leaves the files with mixed endings.

edobez commented 1 month ago

I added the following test line in end_of_file_fixer_test.py to reproduce the problem: (b'foo\r\nbar', 1, b'foo\r\nbar\r\n').

asottile commented 1 month ago

please search the issue tracker