Skip to content

Commit

Permalink
feat: support dots
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 24, 2024
1 parent 7caaf22 commit 98ff9f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mjolnir.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
)

var (
globalFixesIssueRE = regexp.MustCompile(`(?i)(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)(\s+#\d+(?:[\s,]+#\d+)*(?:[\n\r\s,]|$))`)
globalFixesIssueRE = regexp.MustCompile(`(?i)(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)(\s+#\d+(?:[\s,]+#\d+)*\.?(?:[\n\r\s,]|$))`)
fixesIssueRE = regexp.MustCompile(`[\s,]+#`)
cleanNumberRE = regexp.MustCompile(`[\n\r\s,]`)
cleanNumberRE = regexp.MustCompile(`[.\n\r\s,]`)
)

// closeRelatedIssues Closes issues listed in the PR description.
Expand Down
15 changes: 15 additions & 0 deletions mjolnir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ func Test_parseIssueFixes(t *testing.T) {
`,
expectedNumbers: []int{math.MaxInt64},
},
{
name: "valid issue numbers ends with a dot",
text: `
Fixes #13 #14, #15,#16.
`,
expectedNumbers: []int{13, 14, 15, 16},
},
{
name: "multiple lines end with a dot",
text: `
Fixes: #13,#14.
Fixes: #15,#16.
`,
expectedNumbers: []int{13, 14, 15, 16},
},
}

for _, test := range testCases {
Expand Down

0 comments on commit 98ff9f9

Please sign in to comment.