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
Reduce configuration of UnusedPrivateMember's split rules #5800
Conversation
ece4148
to
a92cd74
Compare
a92cd74
to
d070952
Compare
d070952
to
562d9c7
Compare
UnusedParameter: | ||
active: true | ||
allowedNames: '(_|ignored|expected|serialVersionUID)' | ||
allowedNames: 'ignored|expected' | ||
UnusedPrivateClass: | ||
active: true | ||
UnusedPrivateMember: | ||
active: true | ||
allowedNames: '(_|ignored|expected|serialVersionUID)' | ||
allowedNames: '' | ||
UnusedPrivateProperty: | ||
active: true | ||
allowedNames: '(_|ignored|expected|serialVersionUID)' | ||
allowedNames: '_|ignored|expected|serialVersionUID' |
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.
feels like _
should be a parameter name, i.e.
foo.bar { _, x -> ... }
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.
It does... we could open an issue and move that to the other rule.
also I created this test case and we have a lot of false negatives regarding lambdas:
Pair(1, 2).let { (x, y) -> println(y) }
listOf<Int>().map { x -> 1 }.fold(a) { x, y -> y }
val foo: (String, String) -> Unit = { x, y -> println(y) }
And I think that we don't even should configure _
as an unused parameter. That's exactly the reason _
exists.
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.
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.
@BraisGabin based on ^, it looks like we should just remove the _
exception.
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.
I didn't remove it from the property rule because, otherwise, we have false positives right now. We should probably take a look at it. I don't think the lambda check should be in the property rule and I think that we should omit those by default. But that's an improvement out of scope for this PR.
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.
Ah, I see, the lambda param is a "private property", sorry, I missed that.
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.
I was wondering why these were set up the the way they are. Nice one 👏
Those
allowedNames
were copy&pasted whenUnusedPrivateMember
was splitted. But some of them have no sense in some usages.This is a follow up of #5722