Skip to content

removes redefinition of max built-in #1052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rule/function-result-limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
6 changes: 3 additions & 3 deletions rule/line-length-limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions rule/max-control-nesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions rule/max-public-structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Loading