Skip to content

Commit

Permalink
fix parameter name of NamedArguments
Browse files Browse the repository at this point in the history
  • Loading branch information
baseballyama committed May 24, 2024
1 parent bdbaf25 commit 48954f1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ class NamedArguments(config: Config) : Rule(
) {

@Configuration("The allowed number of arguments for a function.")
private val allowedArguments: Int by config(defaultValue = 3)
private val threshold: Int by config(defaultValue = 3)

@Configuration("ignores when argument values are the same as the parameter names")
private val ignoreArgumentsMatchingNames: Boolean by config(defaultValue = false)

override fun visitCallExpression(expression: KtCallExpression) {
val valueArguments = expression.valueArguments.filterNot { it is KtLambdaArgument }
if (valueArguments.size > allowedArguments && expression.canNameArguments()) {
if (valueArguments.size > threshold && expression.canNameArguments()) {
val message = "This function call has ${valueArguments.size} arguments. To call a function with more " +
"than $allowedArguments arguments you should set the name of each argument."
"than $threshold arguments you should set the name of each argument."
report(CodeSmell(Entity.from(expression), message))
} else {
super.visitCallExpression(expression)
Expand Down

0 comments on commit 48954f1

Please sign in to comment.