0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-21 22:10:39 +00:00

fix: const usage and variable reference

issue: #45
This commit is contained in:
hypervtechnics 2022-03-07 11:19:00 +01:00
parent a1498c0832
commit 946024ce0b

View File

@ -11,6 +11,7 @@ const (
breakingChangeFooterKey = "BREAKING CHANGE" breakingChangeFooterKey = "BREAKING CHANGE"
breakingChangeMetadataKey = "breaking-change" breakingChangeMetadataKey = "breaking-change"
issueMetadataKey = "issue" issueMetadataKey = "issue"
messageRegexGroupName = "message"
) )
// CommitMessage is a message using conventional commits. // CommitMessage is a message using conventional commits.
@ -205,8 +206,8 @@ func (p MessageProcessorImpl) Parse(subject, body string) CommitMessage {
filteredSubject := subject filteredSubject := subject
if p.messageCfg.MessageSelector != "" { if p.messageCfg.MessageSelector != "" {
subjectRegex := regexp.MustCompile(p.messageCfg.MessageSelector) subjectRegex := regexp.MustCompile(p.messageCfg.MessageSelector)
subjectMessageIndex := regex.SubexpIndex("message") subjectMessageIndex := subjectRegex.SubexpIndex(messageRegexGroupName)
subjectMatch := regex.FindStringSubmatch(subject) subjectMatch := subjectRegex.FindStringSubmatch(subject)
filteredSubject = subjectMatch[subjectMessageIndex] filteredSubject = subjectMatch[subjectMessageIndex]
} }