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

Line wrap for && #168

Closed
vRallev opened this issue Mar 6, 2018 · 8 comments
Closed

Line wrap for && #168

vRallev opened this issue Mar 6, 2018 · 8 comments

Comments

@vRallev
Copy link

vRallev commented Mar 6, 2018

I've seen f13b93e and probably because of that my code is wrong. My snippet looks like this

            .assertValueAt(2) {
                it is ImageChangeEvent.ImageUpdated
                        && it.position == 0
                        && it.changedFields.contains(CollectImage.IMAGE_MODE)
                        && it.image.imageMode == newImageMode
            }

Kotlin Lint complaints with Line must not begin with "&&". I couldn't find anything regarding that in the Kotlin style guide and to me this rule seems wrong. Can you point me to the rule in the style guide? Is there a way to disable this specific check?

On a side note, this is working fine and Kotlin Lint doesn't complain

            .assertValueAt(2) {
                it is ImageChangeEvent.ImageUpdated
                        && it.position == 0 &&
                        it.changedFields.contains(CollectImage.IMAGE_MODE)
                        && it.image.imageMode == newImageMode
            }
@shyiko
Copy link
Collaborator

shyiko commented Mar 6, 2018

See #163 (comment).
Also, thank you for the snippet.

@shyiko
Copy link
Collaborator

shyiko commented Mar 21, 2018

Fixed in 0.20.0.

@shyiko shyiko closed this as completed Mar 21, 2018
@vRallev
Copy link
Author

vRallev commented Mar 21, 2018

@shyiko No, it's still not working as expected.

if (!isLocal
    && workspace.userId != account.userId
    && workspace.contactId != account.userId) {
}
Class.kt:378:25: Line must not begin with "&&"
Class.kt:379:25: Line must not begin with "&&"

Should I create a new issue or do you want to reopen this one?

@shyiko
Copy link
Collaborator

shyiko commented Mar 21, 2018

@vRallev It works in accordance with #163 (comment).

@vRallev
Copy link
Author

vRallev commented Mar 21, 2018

I can't follow the comments in the link. They're mostly talking about +/- and not && or ||. I couldn't find anything about that. Note that the auto-formatter inside of IntelliJ formats my sample from above like this:

if (!isLocal
    && workspace.userId != account.userId
    && workspace.contactId != account.userId
) {
    // do something after 4 space indent
}

But for the formatter the following is also fine

if (!isLocal && 
    workspace.userId != account.userId && 
    workspace.contactId != account.userId
) {
    // do something after 4 space indent
}

So there's no evidence which one of them is correct.

@starkej2
Copy link

How can we get the intellij auto-formatter to always move those operators to the end of the line? I can't find any options for that setting 🤔

@vojkny
Copy link

vojkny commented Apr 6, 2020

How can we get the intellij auto-formatter to always move those operators to the end of the line? I can't find any options for that setting 🤔

Did you find a solution for that?

@vincent-paing
Copy link

How can we get the intellij auto-formatter to always move those operators to the end of the line? I can't find any options for that setting thinking

Did you find a solution for that?

Have you found the settings for that?

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

5 participants