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

misconfigures the import order when using Mockito #148

Closed
shapan1 opened this issue Nov 16, 2021 · 2 comments
Closed

misconfigures the import order when using Mockito #148

shapan1 opened this issue Nov 16, 2021 · 2 comments

Comments

@shapan1
Copy link

shapan1 commented Nov 16, 2021

Found a bug today where the lexicographical order is unable to correct order Mockito import for when containing the character `

import org.mockito.Mockito.`when`
import org.mockito.Mockito.after
import org.mockito.Mockito.any
import org.mockito.Mockito.doReturn
import org.mockito.Mockito.doThrow

This is the correct order, however ktlint shows this as an error and then after running it. The import are incorrectly ordered to

import org.mockito.Mockito.after
import org.mockito.Mockito.any
import org.mockito.Mockito.doReturn
import org.mockito.Mockito.doThrow
import org.mockito.Mockito.`when`

due to the ` character

@nbadal
Copy link
Owner

nbadal commented Dec 19, 2021

This seems to be the intended behavior, it was changed within ktlint itself here: pinterest/ktlint#1106

The fact that it doesn't match up with the IDE's sorting order is either a ktlint bug, or a bug with the Kotlin plugin as noted in this report.

@nbadal nbadal closed this as completed Dec 19, 2021
@nbadal
Copy link
Owner

nbadal commented Dec 20, 2021

Out of my own curiosity, I have submitted a change to the JetBrains Kotlin plugin to match this ordering, and it will eventually be released in an update 😁

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

2 participants