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

Recommendation 3.1 - recommended ordering of imports #55

Closed
petertrr opened this issue Jul 8, 2020 · 0 comments · Fixed by #380
Closed

Recommendation 3.1 - recommended ordering of imports #55

petertrr opened this issue Jul 8, 2020 · 0 comments · Fixed by #380
Assignees
Labels
enhancement New feature or request
Projects
Milestone

Comments

@petertrr
Copy link
Member

petertrr commented Jul 8, 2020

The following snippet can be a starting point for implementation inside FileStructureRule.kt:

private val recommendedComparator = Comparator<ASTNode> { import1, import2 ->
        require(import1.elementType == IMPORT_DIRECTIVE && import2.elementType == IMPORT_DIRECTIVE) { "This comparator is for sorting imports" }
        val pathSegments1 = (import1.psi as KtImportDirective).importPath!!.fqName.pathSegments()
        val pathSegments2 = (import2.psi as KtImportDirective).importPath!!.fqName.pathSegments()

        return@Comparator 0
    }
@petertrr petertrr added the enhancement New feature or request label Jul 8, 2020
@petertrr petertrr added this to To do in diKTat via automation Jul 8, 2020
@petertrr petertrr added this to the Chapter 3 milestone Jul 30, 2020
diKTat automation moved this from To do to Done tasks Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
diKTat
  
Done tasks
Development

Successfully merging a pull request may close this issue.

1 participant