Skip to content

Commit

Permalink
nit: renames allowTypesLUT into allowTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
chavacava committed Dec 4, 2024
1 parent f96194b commit 3acd476
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rule/context_as_argument.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// ContextAsArgumentRule suggests that `context.Context` should be the first argument of a function.
type ContextAsArgumentRule struct {
allowTypesLUT map[string]struct{}
allowTypes map[string]struct{}

configureOnce sync.Once
}
Expand Down Expand Up @@ -46,8 +46,8 @@ func (r *ContextAsArgumentRule) Apply(file *lint.File, args lint.Arguments) []li
}

typeName := gofmt(arg.Type)
// a parameter of type context.Context is still allowed if the current arg type is in the LUT
_, isCtxStillAllowed = r.allowTypesLUT[typeName]
// a parameter of type context.Context is still allowed if the current arg type is in the allow types LookUpTable
_, isCtxStillAllowed = r.allowTypes[typeName]
}
}

Expand All @@ -60,7 +60,7 @@ func (*ContextAsArgumentRule) Name() string {
}

func (r *ContextAsArgumentRule) configure(arguments lint.Arguments) {
r.allowTypesLUT = r.getAllowTypesFromArguments(arguments)
r.allowTypes = r.getAllowTypesFromArguments(arguments)
}

func (r *ContextAsArgumentRule) getAllowTypesFromArguments(args lint.Arguments) map[string]struct{} {
Expand Down

0 comments on commit 3acd476

Please sign in to comment.