MCPcopy
hub / github.com/larksuite/cli / validateHookName

Method validateHookName

extension/platform/builder.go:188–201  ·  view source on GitHub ↗

validateHookName checks the grammar and uniqueness; returns false when the name was rejected (caller skips the action).

(hookName, kind string)

Source from the content-addressed store, hash-verified

186// validateHookName checks the grammar and uniqueness; returns false
187// when the name was rejected (caller skips the action).
188func (b *Builder) validateHookName(hookName, kind string) bool {
189 if !pluginNamePattern.MatchString(hookName) {
190 b.errs = append(b.errs, fmt.Errorf(
191 "%s %q: hookName must match ^[a-z0-9][a-z0-9-]*$", kind, hookName))
192 return false
193 }
194 if b.hookNames[hookName] {
195 b.errs = append(b.errs, fmt.Errorf(
196 "%s %q: hookName already used in this plugin", kind, hookName))
197 return false
198 }
199 b.hookNames[hookName] = true
200 return true
201}
202
203// builtPlugin is the Plugin implementation the builder emits.
204type builtPlugin struct {

Callers 3

ObserverMethod · 0.95
WrapMethod · 0.95
OnMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected