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

UnusedPrivateMembers on expect class #2636

Closed
fardavide opened this issue Apr 25, 2020 · 1 comment · Fixed by #2643
Closed

UnusedPrivateMembers on expect class #2636

fardavide opened this issue Apr 25, 2020 · 1 comment · Fixed by #2643

Comments

@fardavide
Copy link

Expected Behavior

Function members should not be reported for except class

Observed Behavior

Functions members are reported for expect class

Steps to Reproduce

// _DetektTest.kt

expect class DetektTest  {
    fun test(i: Int)
}
  • write actual declarations that uses the param i
  • run Detekt on CLI and notice the following report:
    UnusedPrivateMember - [i] at ~/_DetektTest.kt:2:14

Context

none

Your Environment

  • Version of detekt used: 1.8.0
  • Version of Gradle used (if applicable): 6.3 stable
  • Operating System and version: macOS 10.15.4 (19E287)
  • Link to your project (if it's a public repository): https://github.com/4face-studi0/Covid19
@mikesamuel
Copy link

I also see this behavior for formal parameters to an expected class constructor or expected function.

expect class Foo(x: Int, y:Int)

expect fun foo(x: Int, y: Int)

Also on release 1.8.0 I get

 style - 20min debt
        UnusedPrivateMember - [x] at .../Foo.kt:14:16
        UnusedPrivateMember - [y] at .../Foo.kt:14:24
        UnusedPrivateMember - [x] at .../Foo.kt:12:18
        UnusedPrivateMember - [y] at .../Foo.kt:12:26

I can workaround via @Suppress("UnusedPrivateMember") on the expect declarations.

@arturbosch arturbosch added this to the 1.9.0 milestone May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants