saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
519 stars 39 forks source link

Diktat 2.0 changes newlines #1828

Closed nulls closed 8 months ago

nulls commented 8 months ago

After applying the diktatFix , the following changes are in source code:

warning: in the working copy of 'save-sandbox/src/main/kotlin/com/saveourtool/save/sandbox/storage/SandboxStorage.kt', LF will be replaced by CRLF the next time Git touches it
nulls commented 8 months ago

Looks like ktlint relates on .editorconfig as a source for endOfLine and lf is value by default. Probably we should configure .editorconfig instead of changing end lines in formatted code: we get a formatted code as output of calling ktlint.

~Also we can set editorConfigDefaults when KtLintRuleEngine is being created~ KtLintRuleEngine is created a single time, but end of line needs to be detected based on a file. So we can support only cases with system specific end of lines