importanize icon indicating copy to clipboard operation
importanize copied to clipboard

Impotanize changes line ending to OS line ending when formatting in place

Open xsaero00 opened this issue 5 years ago • 2 comments

Running importanize on a file that has Unix style endings on Windows will change all line endings to CRLF. It should leave line ending alone and respect source file formatting.

Note: the line ending change only if there is something for importanize to do.

Black used to have this issue too but they fixed it https://github.com/psf/black/issues/258

xsaero00 avatar Jan 21 '20 18:01 xsaero00

it should already honor line endings: https://github.com/miki725/importanize/blob/2f4069c6ebe35262588f2dab5edcde3171964f24/tests/test_parser.py#L31-L34

not sure if I have more direct test case for windows line endings but I can add one higher level test

miki725 avatar Jan 21 '20 19:01 miki725

https://github.com/miki725/importanize/pull/70/commits/5b31652b6fc3ce0eb13e6eb783b0494716865209 tests windows line endings and it seems to work as expected. can you link to a sample file where you are having issues? does it have mixed newlines? importanize uses the first newline it encounters. if the file has mixed newlines output could be different

miki725 avatar Jan 22 '20 02:01 miki725