Yesterday I released a trial version of Code-Tidyall. This version contains a change based on a PR by Kenneth Ölwing that (I hope) prevents tidyall from munging line endings when it processes a file.
The problem the PR fixes can occur when you have a file with Unix line endings and you run tidyall
on Windows. Most tidyall plugins that do tidying (as opposed to linting) will open the file and
rewrite it using Perl. Specifically, they were using Path::Tiny
’s slurp
and spew
methods.
These methods open files using the default IO layers, which on Windows includes the :crlf
layer.
That layer will translate CRLF into LF on read and back again on write. But if the file was
already just using LF as the line ending, that means that it will get converted to CRLF on
write!
So the fix was to use slurp_raw
and spew_raw
everywhere. But that is a big change, and I
could easily see it breaking some plugin or use case out there.
If you use tidyall please please test this trial release and file bugs for any breakage you find. Absent any breaking bugs, I will probably release this change in 3-4 weeks in a non-trial release.
And a big thank you to Kenneth for finding the problem and the solution!