Skip to content

Commit

Permalink
Made no-unused-imports rule reset internal state "on file"
Browse files Browse the repository at this point in the history
  • Loading branch information
shyiko committed Nov 28, 2017
1 parent 22ff8b3 commit ea3c6fb
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ class NoUnusedImportsRule : Rule("no-unused-imports") {
// destructuring assignment
"component1", "component2", "component3", "component4", "component5"
)
private val ref = mutableSetOf("*")
private val ref = mutableSetOf<String>()
private var packageName = ""

override fun visit(node: ASTNode, autoCorrect: Boolean,
emit: (offset: Int, errorMessage: String, canBeAutoCorrected: Boolean) -> Unit) {
if (node.elementType == KtStubElementTypes.FILE) {
ref.clear() // rule can potentially be executed more than once (when formatting)
ref.add("*")
node.visit { vnode ->
val psi = vnode.psi
val type = vnode.elementType
Expand Down

0 comments on commit ea3c6fb

Please # to comment.