0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-28 16:40:36 +00:00

refactor: fix lint golint uncommented exported method

This commit is contained in:
Beatriz Vieira 2021-07-31 18:19:57 -03:00
parent d76920bb5c
commit 10ec6f18c4

View File

@ -101,6 +101,7 @@ func (p MessageProcessorImpl) Validate(message string) error {
return nil return nil
} }
// ValidateType check if commit type is valid.
func (p MessageProcessorImpl) ValidateType(ctype string) error { func (p MessageProcessorImpl) ValidateType(ctype string) error {
if ctype == "" || !contains(ctype, p.messageCfg.Types) { if ctype == "" || !contains(ctype, p.messageCfg.Types) {
return fmt.Errorf("message type should be one of [%v]", strings.Join(p.messageCfg.Types, ", ")) return fmt.Errorf("message type should be one of [%v]", strings.Join(p.messageCfg.Types, ", "))
@ -108,6 +109,7 @@ func (p MessageProcessorImpl) ValidateType(ctype string) error {
return nil return nil
} }
// ValidateScope check if commit scope is valid.
func (p MessageProcessorImpl) ValidateScope(scope string) error { func (p MessageProcessorImpl) ValidateScope(scope string) error {
if len(p.messageCfg.Scope.Values) > 0 && !contains(scope, p.messageCfg.Scope.Values) { if len(p.messageCfg.Scope.Values) > 0 && !contains(scope, p.messageCfg.Scope.Values) {
return fmt.Errorf("message scope should one of [%v]", strings.Join(p.messageCfg.Scope.Values, ", ")) return fmt.Errorf("message scope should one of [%v]", strings.Join(p.messageCfg.Scope.Values, ", "))
@ -115,6 +117,7 @@ func (p MessageProcessorImpl) ValidateScope(scope string) error {
return nil return nil
} }
// ValidateDescription check if commit description is valid.
func (p MessageProcessorImpl) ValidateDescription(description string) error { func (p MessageProcessorImpl) ValidateDescription(description string) error {
if !regexp.MustCompile("^[a-z]+.*$").MatchString(description) { if !regexp.MustCompile("^[a-z]+.*$").MatchString(description) {
return fmt.Errorf("description [%s] should begins with lowercase letter", description) return fmt.Errorf("description [%s] should begins with lowercase letter", description)