0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-21 12:00:40 +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"
breakingChangeMetadataKey = "breaking-change"
issueMetadataKey = "issue"
messageRegexGroupName = "message"
)
// CommitMessage is a message using conventional commits.
@ -205,8 +206,8 @@ func (p MessageProcessorImpl) Parse(subject, body string) CommitMessage {
filteredSubject := subject
if p.messageCfg.MessageSelector != "" {
subjectRegex := regexp.MustCompile(p.messageCfg.MessageSelector)
subjectMessageIndex := regex.SubexpIndex("message")
subjectMatch := regex.FindStringSubmatch(subject)
subjectMessageIndex := subjectRegex.SubexpIndex(messageRegexGroupName)
subjectMatch := subjectRegex.FindStringSubmatch(subject)
filteredSubject = subjectMatch[subjectMessageIndex]
}