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
UnusedPrivateProperty: Fix false postive by ignoring data classes #6151
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6151 +/- ##
============================================
- Coverage 84.94% 84.94% -0.01%
Complexity 4026 4026
============================================
Files 569 569
Lines 13498 13501 +3
Branches 2381 2384 +3
============================================
+ Hits 11466 11468 +2
Misses 869 869
- Partials 1163 1164 +1
|
@@ -108,7 +109,8 @@ private class UnusedPrivatePropertyVisitor(private val allowedNames: Regex) : De | |||
constructor.valueParameters | |||
.filter { | |||
(it.isPrivate() || (!it.hasValOrVar() && !constructor.isActual())) && | |||
it.containingClassOrObject?.isExpect() == false | |||
it.containingClassOrObject?.isExpect() == false && | |||
(constructor.parent as? KtClass)?.isData() != true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same goes for value
classes.
@JvmInline value class Foo(private val value: String)
inline class Bar(private val value: String)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Fixes: #6142