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
Layout/EndOfLine does not choose correct default line ending #6720
Comments
Do you know how Rubocop can know the correct line ending on JRuby? |
Using Edit: |
Thanks for the report and investigation @enkessler! 🙇 Would you be interested in opening a PR for this? |
I can take a crack at it some time this week, sure. |
Using a different constant to determine the current operating system.
Including the bug fix for rubocop#6720.
The Layout/EndOfLine cop automatically decides the 'correct' line ending when set to
:native
. However, the logic used to make that decision does not come to the correct answer when using JRuby. The check being used isRuboCop::Platform.windows?
which just does an inspection ofRUBY_PLATFORM
:RUBY_PLATFORM =~ /cygwin|mswin|mingw|bccwin|wince|emx/
However, when using JRuby the value of
RUBY_PLATFORM
will bejava
, even when using Windows. This results in the cop deciding that it is in a non-Windows environment and thus check for 'lf' line endings instead of 'crlf'.Expected behavior
The Layout/EndOfLine cop should natively use 'crlf' line endings for Windows with JRuby.
Actual behavior
The Layout/EndOfLine cop natively uses 'lf' line endings for Windows with JRuby.
Steps to reproduce the problem
Run rubocop against the file and the generated report will contain violations for Layout/EndOfLine.
RuboCop version
0.63.1 (using Parser 2.6.0.0, running on jruby 2.3.3 java)
The text was updated successfully, but these errors were encountered: