Skip to content

Commit

Permalink
NoWildcardImportsRule: don't report it if asterisk with backticks (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kameyama authored Jun 27, 2020
1 parent c7bdae0 commit bac44ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class NoWildcardImportsRule : Rule("no-wildcard-imports") {
) {
if (node.elementType == IMPORT_DIRECTIVE) {
val importDirective = node.psi as KtImportDirective
val path = importDirective.importPath?.pathStr
if (path != null && !path.startsWith("kotlinx.android.synthetic") && path.contains('*')) {
val path = importDirective.importPath
if (path != null && path.isAllUnder && !path.pathStr.startsWith("kotlinx.android.synthetic")) {
emit(node.startOffset, "Wildcard import", false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class NoWildcardImportsRuleTest {
import a.b.c.*
import a.b
import kotlinx.android.synthetic.main.layout_name.*
import foo.bar.`**`
""".trimIndent()
)
).isEqualTo(
Expand Down

0 comments on commit bac44ab

Please sign in to comment.