You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fun myExampleMethodWithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): () -> Unit =
{ System.out.println("Hello World!") }
With the default max line length of 100 characters, this code does not exceed the max line length.
2. Save the file, and commit the change with git.
3. Run the ktlint format task with ktlint version 0.35.0.
4. Run git diff.
Expected behavior
The example method should either be unchanged, or it should at least not get reformatted to exceed the max line length.
Actual behavior
The method gets reformatted to exceed the max line length which causes a lint error. git diff shows the following change:
- fun myExampleMethodWithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): () -> Unit =
- { System.out.println("Hello World!") }
+ fun myExampleMethodWithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): () -> Unit = { System.out.println("Hello World!") }
I would like to enable the max line length lint rule and then auto-format my entire project using Android Studio 3.5.1's max-line-length code styles that wrap long lines. However, whether I fix the max-line-length violations manually or with the IDE, I can't enable the lint rule because ktlint's autoformatter will cause lint errors. Is there a known version of ktlint where the auto-formatter does not cause this max line length error? Thanks!
The text was updated successfully, but these errors were encountered:
donaldchen
changed the title
ktlintFormat causes lint error for max line length violation
ktlintFormat causes lint error for max line length rule
Nov 6, 2019
Steps to reproduce
With the default max line length of 100 characters, this code does not exceed the max line length.
2. Save the file, and commit the change with git.
3. Run the ktlint format task with ktlint version
0.35.0
.4. Run
git diff
.Expected behavior
The example method should either be unchanged, or it should at least not get reformatted to exceed the max line length.
Actual behavior
The method gets reformatted to exceed the max line length which causes a lint error.
git diff
shows the following change:I would like to enable the max line length lint rule and then auto-format my entire project using Android Studio 3.5.1's max-line-length code styles that wrap long lines. However, whether I fix the max-line-length violations manually or with the IDE, I can't enable the lint rule because ktlint's autoformatter will cause lint errors. Is there a known version of ktlint where the auto-formatter does not cause this max line length error? Thanks!
The text was updated successfully, but these errors were encountered: