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

Enhancments for functional style in NewlinesRule #492

Closed
petertrr opened this issue Nov 4, 2020 · 1 comment · Fixed by #580
Closed

Enhancments for functional style in NewlinesRule #492

petertrr opened this issue Nov 4, 2020 · 1 comment · Fixed by #580
Assignees

Comments

@petertrr
Copy link
Member

petertrr commented Nov 4, 2020

It actually even isn't compliant with our current code style: we are forcing a line break after it, but I thought it looks too ugly. I'll add an issue about making this rule prettier and maybe taking into account text length.

Originally posted by @petertrr in #485 (comment)

@petertrr
Copy link
Member Author

fun foo() {
foo.map()
.bar().foo()
}

=>

fun foo() {
foo.map()
.bar()
.foo()
}

========

fun foo() {
foo
.map()
.bar().foo()
}

=>

fun foo() {
foo
.map()
.bar()
.foo()
}

=================

fun foo() {
foo
.map().bar().foo()
}

=>

fun foo() {
foo
.map()
.bar()
.foo()
}

=======================

fun foo() {
foo
.map()
.bar()
.foo()
}

=>

fun foo() {
foo
.map()
.bar()
.foo()
}

==================

fun foo() {
foo.map().bar().foo()
}

=>

fun foo() {
foo.map()
.bar()
.foo()
}

========================

extendedIndentBeforeDot = false (by the defaut)

safe access (?.) - same as dot

but !! - needs line break

fun foo() {
foo!!.map()
.bar()
.foo()
}

=>

fun foo() {
foo!!
.map()
.bar()
.foo()
}

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

Successfully merging a pull request may close this issue.

2 participants