Skip to content

Commit

Permalink
Resolves pinterest#1393
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-dingemans committed Mar 12, 2022
1 parent 3b70631 commit 483b7ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This section is applicable when providing rules that depend on one or more value
- Do not remove trailing comma after a parameter of type array in an annotation (experimental:trailing-comma) ([#1379](https://github.com/pinterest/ktlint/issues/1379))
- Do not delete blank lines in KDoc (no-trailing-spaces) ([#1376](https://github.com/pinterest/ktlint/issues/1376))
- Do not indent raw string literals that are not followed by either trimIndent() or trimMargin() (`indent`) ([#1375](https://github.com/pinterest/ktlint/issues/1375))
- Revert remove unnecessary wildcard imports as introduced in Ktlint 0.43.0 (`no-unused-imports`) ([#1277](https://github.com/pinterest/ktlint/issues/1277)), ([#1256](https://github.com/pinterest/ktlint/issues/1256))
- Revert remove unnecessary wildcard imports as introduced in Ktlint 0.43.0 (`no-unused-imports`) ([#1277](https://github.com/pinterest/ktlint/issues/1277)), ([#1393](https://github.com/pinterest/ktlint/issues/1393)), ([#1256](https://github.com/pinterest/ktlint/issues/1256))

### Changed
- Print the rule id always in the PlainReporter ([#1121](https://github.com/pinterest/ktlint/issues/1121))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,4 +915,24 @@ class NoUnusedImportsRuleTest {
)
).isEmpty()
}

@Test
fun `Issue 1393 - Wildcard import should not be removed because it can not be reliable be determined whether it is used`() {
val rule = NoUnusedImportsRule()
assertThat(
rule.lint(
"""
package com.example
import com.example.Outer.*
class Outer {
class Inner
}
val foo = Inner()
""".trimIndent()
)
).isEmpty()
}
}

0 comments on commit 483b7ee

Please sign in to comment.