Skip to content

Commit

Permalink
Remove Suppress annotation from UnusedImports (#3202)
Browse files Browse the repository at this point in the history
  • Loading branch information
schalkms authored and arturbosch committed Dec 14, 2020
1 parent 81d5dde commit dccb05e
Showing 1 changed file with 9 additions and 6 deletions.
Expand Up @@ -84,13 +84,16 @@ class UnusedImports(config: Config) : Rule(config) {
super.visitPackageDirective(directive)
}

@Suppress("UnsafeCallOnNullableType")
override fun visitImportList(importList: KtImportList) {
imports = importList.imports.asSequence().filter { it.isValidImport }
.filter { it.identifier()?.contains("*")?.not() == true }
.filter { it.identifier() != null }
.filter { !operatorSet.contains(it.identifier()) }
.filter { !componentNRegex.matches(it.identifier()!!) }.toList()
imports = importList.imports.asSequence()
.filter { it.isValidImport }
.filter {
val identifier = it.identifier()
identifier?.contains("*")?.not() == true &&
!operatorSet.contains(identifier) &&
!componentNRegex.matches(identifier)
}
.toList()
super.visitImportList(importList)
}

Expand Down

0 comments on commit dccb05e

Please sign in to comment.