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

MemberNameEqualsClassName ignores functions which return a single expression #655

Closed
schalkms opened this issue Jan 1, 2018 · 0 comments · Fixed by #2502
Closed

MemberNameEqualsClassName ignores functions which return a single expression #655

schalkms opened this issue Jan 1, 2018 · 0 comments · Fixed by #2502

Comments

@schalkms
Copy link
Member

schalkms commented Jan 1, 2018

As mentioned in #653
this rule ignores functions which return a single expression since detekt cannot infer the type (at the moment).
Consider the following code for example

open class A {
  companion object {
    // return type = A
    fun a(condition: Boolean) = if (condition) B() else C()
  }
}

class B: A()
class C: A()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants