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

NamedArguments: Ignore when argument values are the same as the parameter name #4613

Merged
merged 2 commits into from Mar 10, 2022

Conversation

t-kameyama
Copy link
Contributor

Fixes #4591

@marschwar
Copy link
Contributor

marschwar commented Mar 7, 2022

Should those examples below be considered ok or not?

class Baz {
    private var b: Int = 42
    fun foo(a: Int, b: Int, c: Int) {}
    fun bar(a: Int, c: Int) {
        foo(a, this.b, c)
    }
}
data class Baz(val b: Int)
fun foo(a: Int, b: Int, c: Int) {}
fun bar(a: Int, c: Int, baz: Baz?) {
    baz?.let { foo(a, it.b, c) }
}

[edit] To be clear, it think they should be flagged (as it is implemented) but I would like to have a test case that verifies it.

@BraisGabin BraisGabin added this to the 1.20.0 milestone Mar 10, 2022
@BraisGabin BraisGabin merged commit 1269b9b into detekt:main Mar 10, 2022
@t-kameyama t-kameyama deleted the issue_4591 branch March 10, 2022 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NamedArguments: Ignore when argument values are the same as the parameter names
4 participants