Skip to content

Commit

Permalink
nit: failure in the happy path
Browse files Browse the repository at this point in the history
  • Loading branch information
chavacava committed Dec 4, 2024
1 parent 57e4695 commit c17efaf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions rule/function_result_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ func (r *FunctionResultsLimitRule) Apply(file *lint.File, arguments lint.Argumen
num = funcDecl.Type.Results.NumFields()
}

if num > r.max {
failures = append(failures, lint.Failure{
Confidence: 1,
Failure: fmt.Sprintf("maximum number of return results per function exceeded; max %d but got %d", r.max, num),
Node: funcDecl.Type,
})
if num <= r.max {
continue
}

failures = append(failures, lint.Failure{
Confidence: 1,
Failure: fmt.Sprintf("maximum number of return results per function exceeded; max %d but got %d", r.max, num),
Node: funcDecl.Type,
})
}

return failures
Expand Down

0 comments on commit c17efaf

Please sign in to comment.