Skip to content

Commit

Permalink
Remove exclusion of id prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rockstaedt committed Aug 4, 2023
1 parent 146f6f1 commit 1bab9e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions internal/model/commit_message.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package model

import (
"regexp"
"strings"
)

Expand All @@ -26,15 +25,8 @@ func (cm *CommitMessage) ValidateSubject() int {
return 0
}

if currentSubjectLength > 72 {
return currentSubjectLength - 50
}

if currentSubjectLength > 50 {
re := regexp.MustCompile(`^#\d+ -\s*(.*)$`)
trimmedSubject := re.ReplaceAllString(cm.Subject, `$1`)

return len(trimmedSubject) - 50
return currentSubjectLength - 50
}

return 0
Expand Down
2 changes: 1 addition & 1 deletion internal/model/commit_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestNewCommitMessage(t *testing.T) {
}{
{"more than................72....................................characters", 23},
{"more than................50................less than 72 characters", 16},
{"#1301 - more than........50..............through ID prefix", 0},
{"#1301 - more than........50..............through ID prefix", 8},
{"short subject line", 0},
{"Merge pull request commits are ignored because they can easily exceed 52 characters", 0},
{"Merge branch commits are also ignored..............................................", 0},
Expand Down

0 comments on commit 1bab9e4

Please sign in to comment.