mirror of
https://github.com/mgechev/revive.git
synced 2024-11-24 08:32:22 +02:00
Check max value and add more information about what the rule received as argument.
This commit is contained in:
parent
dd1a8bf4e6
commit
f02afab00f
@ -18,7 +18,10 @@ func (r *FunctionResultsLimitRule) Apply(file *lint.File, arguments lint.Argumen
|
||||
|
||||
max, ok := arguments[0].(int64) // Alt. non panicking version
|
||||
if !ok {
|
||||
panic(`invalid value passed as return results number to the "function-result-limit" rule`)
|
||||
panic(fmt.Sprintf(`invalid value passed as return results number to the "function-result-limit" rule; need int64 but got %T`, arguments[0]))
|
||||
}
|
||||
if max < 0 {
|
||||
panic(`the value passed as return results number to the "function-result-limit" rule cannot be negative`)
|
||||
}
|
||||
|
||||
var failures []lint.Failure
|
||||
|
Loading…
Reference in New Issue
Block a user