KT.NAMED_ARGUMENTS

Function parameters are not named

Reports function invocations which have more parameters than a certain threshold and are all not named.

Noncompliant Code

Copy
fun sum(a: Int, b: Int, c: Int, d: Int) {
}
sum(1, 2, 3, 4)

Compliant Code

Copy
fun sum(a: Int, b: Int, c: Int, d: Int) {
}
sum(a = 1, b = 2, c = 3, d = 4)

Options

  • threshold (default: 3)

    number of parameters that triggers this inspection

  • ignoreArgumentsMatchingNames (default: False)

    ignores when argument values are the same as the parameter names

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html