From 831f3a37238f9476d4c87d97e0392101f9046910 Mon Sep 17 00:00:00 2001 From: Beatriz Vieira Date: Thu, 25 Feb 2021 22:40:07 -0300 Subject: [PATCH] refactor(validate-commit-message): print subject at validation error issue: #11 --- sv/message.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sv/message.go b/sv/message.go index 2208b06..a59888a 100644 --- a/sv/message.go +++ b/sv/message.go @@ -2,7 +2,6 @@ package sv import ( "bufio" - "errors" "fmt" "regexp" "strings" @@ -81,7 +80,7 @@ func (p MessageProcessorImpl) Validate(message string) error { msg := p.Parse(subject, body) if !regexp.MustCompile("^[a-z+]+(\\(.+\\))?!?: .+$").MatchString(subject) { - return errors.New("message should be valid according with conventional commits") + return fmt.Errorf("subject [%s] should be valid according with conventional commits", subject) } if msg.Type == "" || !contains(msg.Type, p.messageCfg.Types) {