From fa37c00bdffc2c659e4b19525574784277f63c15 Mon Sep 17 00:00:00 2001 From: chavacava Date: Sun, 29 Sep 2024 10:08:15 +0200 Subject: [PATCH] removes redefinition of max built-in (#1052) --- rule/function-result-limit.go | 6 +++--- rule/line-length-limit.go | 6 +++--- rule/max-control-nesting.go | 4 ++-- rule/max-public-structs.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rule/function-result-limit.go b/rule/function-result-limit.go index 6a0748011..c125d0570 100644 --- a/rule/function-result-limit.go +++ b/rule/function-result-limit.go @@ -24,14 +24,14 @@ func (r *FunctionResultsLimitRule) configure(arguments lint.Arguments) { r.max = defaultResultsLimit return } - max, ok := arguments[0].(int64) // Alt. non panicking version + maxResults, ok := arguments[0].(int64) // Alt. non panicking version 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])) } - if max < 0 { + if maxResults < 0 { 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) } } diff --git a/rule/line-length-limit.go b/rule/line-length-limit.go index 1a414f691..6e55cbb38 100644 --- a/rule/line-length-limit.go +++ b/rule/line-length-limit.go @@ -29,12 +29,12 @@ func (r *LineLengthLimitRule) configure(arguments lint.Arguments) { return } - max, ok := arguments[0].(int64) // Alt. non panicking version - if !ok || max < 0 { + maxLength, ok := arguments[0].(int64) // Alt. non panicking version + if !ok || maxLength < 0 { panic(`invalid value passed as argument number to the "line-length-limit" rule`) } - r.max = int(max) + r.max = int(maxLength) } } diff --git a/rule/max-control-nesting.go b/rule/max-control-nesting.go index c4eb36193..e15d42e0b 100644 --- a/rule/max-control-nesting.go +++ b/rule/max-control-nesting.go @@ -120,9 +120,9 @@ func (r *MaxControlNestingRule) configure(arguments lint.Arguments) { 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 { panic(`invalid value passed as argument number to the "max-control-nesting" rule`) } - r.max = max + r.max = maxNesting } diff --git a/rule/max-public-structs.go b/rule/max-public-structs.go index 25be3e676..b06e51f1b 100644 --- a/rule/max-public-structs.go +++ b/rule/max-public-structs.go @@ -27,11 +27,11 @@ func (r *MaxPublicStructsRule) configure(arguments lint.Arguments) { 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 { panic(`invalid value passed as argument number to the "max-public-structs" rule`) } - r.max = max + r.max = maxStructs } }