mirror of
https://github.com/mgechev/revive.git
synced 2025-03-19 21:07:46 +02:00
removes redefinition of max built-in (#1052)
This commit is contained in:
parent
e9b7f3aa68
commit
fa37c00bdf
@ -24,14 +24,14 @@ func (r *FunctionResultsLimitRule) configure(arguments lint.Arguments) {
|
|||||||
r.max = defaultResultsLimit
|
r.max = defaultResultsLimit
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
max, ok := arguments[0].(int64) // Alt. non panicking version
|
maxResults, ok := arguments[0].(int64) // Alt. non panicking version
|
||||||
if !ok {
|
if !ok {
|
||||||
panic(fmt.Sprintf(`invalid value passed as return results number to the "function-result-limit" rule; need int64 but got %T`, arguments[0]))
|
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 {
|
if maxResults < 0 {
|
||||||
panic(`the value passed as return results number to the "function-result-limit" rule cannot be negative`)
|
panic(`the value passed as return results number to the "function-result-limit" rule cannot be negative`)
|
||||||
}
|
}
|
||||||
r.max = int(max)
|
r.max = int(maxResults)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ func (r *LineLengthLimitRule) configure(arguments lint.Arguments) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
max, ok := arguments[0].(int64) // Alt. non panicking version
|
maxLength, ok := arguments[0].(int64) // Alt. non panicking version
|
||||||
if !ok || max < 0 {
|
if !ok || maxLength < 0 {
|
||||||
panic(`invalid value passed as argument number to the "line-length-limit" rule`)
|
panic(`invalid value passed as argument number to the "line-length-limit" rule`)
|
||||||
}
|
}
|
||||||
|
|
||||||
r.max = int(max)
|
r.max = int(maxLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ func (r *MaxControlNestingRule) configure(arguments lint.Arguments) {
|
|||||||
|
|
||||||
checkNumberOfArguments(1, arguments, r.Name())
|
checkNumberOfArguments(1, arguments, r.Name())
|
||||||
|
|
||||||
max, ok := arguments[0].(int64) // Alt. non panicking version
|
maxNesting, ok := arguments[0].(int64) // Alt. non panicking version
|
||||||
if !ok {
|
if !ok {
|
||||||
panic(`invalid value passed as argument number to the "max-control-nesting" rule`)
|
panic(`invalid value passed as argument number to the "max-control-nesting" rule`)
|
||||||
}
|
}
|
||||||
r.max = max
|
r.max = maxNesting
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,11 @@ func (r *MaxPublicStructsRule) configure(arguments lint.Arguments) {
|
|||||||
|
|
||||||
checkNumberOfArguments(1, arguments, r.Name())
|
checkNumberOfArguments(1, arguments, r.Name())
|
||||||
|
|
||||||
max, ok := arguments[0].(int64) // Alt. non panicking version
|
maxStructs, ok := arguments[0].(int64) // Alt. non panicking version
|
||||||
if !ok {
|
if !ok {
|
||||||
panic(`invalid value passed as argument number to the "max-public-structs" rule`)
|
panic(`invalid value passed as argument number to the "max-public-structs" rule`)
|
||||||
}
|
}
|
||||||
r.max = max
|
r.max = maxStructs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user