Closed ChristianZimpelmann closed 1 year ago
Merging #455 (88049f3) into main (6d762a5) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## main #455 +/- ##
=======================================
Coverage 93.24% 93.24%
=======================================
Files 247 247
Lines 17987 17987
=======================================
Hits 16772 16772
Misses 1215 1215
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
Hi @ChristianZimpelmann, can you describe the problem you get with the mixed-line-ending hook? I thought the whole point of that hook was to fix such problems.
Hi @ChristianZimpelmann, can you describe the problem you get with the mixed-line-ending hook? I thought the whole point of that hook was to fix such problems.
The problem is that mixed-line-ending
and update-environment-files
fail alternatingly and alternatingly change the line endings from LF to CRLF and viceversa. Somehow mixed-line-ending
does not check the files created by update-environment-files
during the same pre-commit run, but only after I try to commit again.
Ah, probably because they are not staged.
I was just worried how robust this approach is. Do you have a source for this trick? Then we could just add a comment and the source to explain why we open a yaml file in binary mode.
Good point!
I found a much better solution now, but nevertheless added a comment including a source for the solution.
Our development environment already uses Python 3.10, so we could probably also use this, right?
Path('my.txt').write_text('hello\nworld', newline='\n')
Thanks, @timmens for the reference! That seems like the best solution.
On Windows, the environment files created by
update_envs
have CRLF line endings.In particular, this leads to problems with the
mixed-line-ending
hook.This PR makes sure that LF line endings are used by opening the file in binary mode.
I am of course open for other solutions.