-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle Windows newlines gracefully #205
Comments
By the way: in the process of investigating the issue I pretty much fixed it, so let me know and I can open a PR (which I didn't do already because at some point I read |
Here's the fix and here's confirmation that it worked. If you agree with the solution, I'll open a PR. If not, I'm open to exploring other options (and I'll understand if you don't even consider this a real problem, given how few people are actually using Windows to develop Erlang.) |
@g-andrade Great catch! Amazing description! Incredibly thorough explanation! And perfect fix! I would ❤️ to have that as a PR 🙏🏻 |
Bug Description
Recently I tried to run CI for my lib on Windows.
All the tests passed (surprisingly!) but Elvis (invoked through
rebar3_lint
) complained a lot about trailing spaces and operator spaces. Like, for almost every line of code.So, what's happening is:
git
can be configured to automatically convert line endings into whatever the OS's native ones are.And that's what it does by default on the Windows image I used, apparently.
However,
elvis_core
only knows how to split lines using\n
(e.g. here, which leaves all of those extra\r
around (and they qualify as whitespace.)To Reproduce
Now that's tricky 🤔 I don't have Windows myself.
But it boils down to:
rebar3_lint
on Windows, andrebar3 lint
.Alternatively, leveraging GitHub Actions for CI'ing on Windows should be enough to confirm the problem.
Expected Behavior
I expected that any newline-affected rules (e.g.
no_trailing_whitespace
) would take into account Windows newline endings gracefully (\r\n
rather than just\n
.)rebar3
LogsHere it is (let me know if more details are needed.)
Additional Context
rebar3_lint
version: 0.5.0 (which importselvis_core
1.2.0)The text was updated successfully, but these errors were encountered: