mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-22 08:20:39 +00:00
refactor: fix lint gosimple S1007
This commit is contained in:
parent
6fd31b9aa0
commit
178239a666
@ -82,7 +82,7 @@ func (p MessageProcessorImpl) Validate(message string) error {
|
|||||||
subject, body := splitCommitMessageContent(message)
|
subject, body := splitCommitMessageContent(message)
|
||||||
msg := p.Parse(subject, body)
|
msg := p.Parse(subject, body)
|
||||||
|
|
||||||
if !regexp.MustCompile("^[a-z+]+(\\(.+\\))?!?: .+$").MatchString(subject) {
|
if !regexp.MustCompile(`^[a-z+]+(\(.+\))?!?: .+$`).MatchString(subject) {
|
||||||
return fmt.Errorf("subject [%s] should be valid according with conventional commits", subject)
|
return fmt.Errorf("subject [%s] should be valid according with conventional commits", subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ func (p MessageProcessorImpl) Parse(subject, body string) CommitMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseSubjectMessage(message string) (string, string, string, bool) {
|
func parseSubjectMessage(message string) (string, string, string, bool) {
|
||||||
regex := regexp.MustCompile("([a-z]+)(\\((.*)\\))?(!)?: (.*)")
|
regex := regexp.MustCompile(`([a-z]+)(\((.*)\))?(!)?: (.*)`)
|
||||||
result := regex.FindStringSubmatch(message)
|
result := regex.FindStringSubmatch(message)
|
||||||
if len(result) != 6 {
|
if len(result) != 6 {
|
||||||
return "", "", message, false
|
return "", "", message, false
|
||||||
|
Loading…
Reference in New Issue
Block a user