-
Notifications
You must be signed in to change notification settings - Fork 509
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
Remove code that was inserting newline after = in a chained call #387
Conversation
shashachu
commented
Apr 19, 2019
- Fixes IndentationRule inserting unnecessary line break after assignment followed by any continuation #368 and MissingNewLine triggered on builder chain like pattern #380
- Kotlin styleguide: https://kotlinlang.org/docs/reference/coding-conventions.html#chained-call-wrapping
- Says 'The first call in the chain usually should have a line break before it, but it's OK to omit it if the code makes more sense that way.'
20bc8f1
to
0ba9b1a
Compare
@vanniktech thoughts on this one? I just removed the code that was inserting the newline after the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not totally certain that I'm on board with this change.
...experimental/src/test/resources/spec/indent/format-dot-qualified-expression-expected.kt.spec
Show resolved
Hide resolved
...t-experimental/src/test/resources/spec/indent/format-raw-string-trim-indent-expected.kt.spec
Outdated
Show resolved
Hide resolved
I re-introduced the rule for raw strings but removed the rest. I also added a test verifying the linebreak after = in chained calls is still allowed, just not forced. |
...xperimental/src/test/kotlin/com/pinterest/ktlint/ruleset/experimental/IndentationRuleTest.kt
Outdated
Show resolved
Hide resolved
val x = | ||
"a" + | ||
"b2" | ||
val x = "a" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't know if this better...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really? it seems better to me. but the previous formatting is still allowed, just not forced.
) + f1( | ||
"sssss" | ||
) | ||
val x = paths.flatMap { dir -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does seem slightly better, though
get() = | ||
this.javaClass.name | ||
.fn() | ||
get() = this.javaClass.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am also unsure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both look bad to me, but the extra newline irks me. maybe it's just me. :)
…terest#387) * Remove code that was inserting newline after = except for raw strings
…terest#387) * Remove code that was inserting newline after = except for raw strings