Skip to content
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

Problems with Line-Endings #2793

Closed
feanaro88 opened this issue Sep 11, 2024 · 1 comment
Closed

Problems with Line-Endings #2793

feanaro88 opened this issue Sep 11, 2024 · 1 comment

Comments

@feanaro88
Copy link

feanaro88 commented Sep 11, 2024

Expected Behavior

We are a small Team of Devs with different OS (Linux, Mac, Windows) so we all have systems with different line endings.
Since we switched from 0.47.1 to ktlint-cli 1.3.0 the tool touches the line endings. I have searched for an option that just says: keep the line-endings as they are. But only the following are supported in the .editorconfig:
end_of_line = lf
end_of_line = crlf
end_of_line = cr

So what we have done is to create an .editorconfig_win/.editorconfig (as default for linux) /.editorconfig_mac with identical rulesets but differet eol.

The next problem occured: It seems if i run ktlint and if it finds any ".editorconfig" the settings of this file overwrites any passed editorconfig argument.
=>
grafik
If i run
ktlint --editorconfig=.editorconfig_win -F
on my windows machine, all the files get LF ending instead of CRLF.

As a workaround every Dev just sets temporaly the correct line ending in the .editorconfig for formatting. This is a risk, they have to take care not to check in their eol-setting...

  1. We need a "end_of_line = keep it " option
  2. If a default .editorconfig file is found in the CWD it should not overwrite settings of a argument-passed editorconfig

Your Environment

  • Version of ktlint used: 1.3.0
  • Relevant parts of the .editorconfig settings: end_of_line = cr/crlf/lf
  • Operating System and version: Multiple Windows 11/10, Ubuntu 22.4 and some macos quatsch (i dont like macos :))
@paul-dingemans
Copy link
Collaborator

Duplicate of #2747

@paul-dingemans paul-dingemans marked this as a duplicate of #2747 Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants