Skip to content

Commit 6b427d4

Browse files
thepuddsgopherbot
authored andcommitted
cmd/gerritbot/internal/rules: stop complaining about trailing period after bug number
Some contributors (including on the core Go team) prefer to end the bug number reference with a trailing period, like 'For #nnn.', so adjust the GitHub PR rules to allow that without complaint. The Contribution Guide does not use that style in its examples, but https://go.dev/wiki/CommitMessage was updated to mention it is allowed. Updates golang/go#61573 Change-Id: Idac4cef24bff22241dfc786684fe536def12f24f Reviewed-on: https://go-review.googlesource.com/c/build/+/525975 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
1 parent 10d6e25 commit 6b427d4

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

cmd/gerritbot/internal/rules/rules.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,22 +322,22 @@ var ruleGroups = [][]rule{
322322
name: "body: bug format looks incorrect",
323323
skip: []string{"proposal"},
324324
f: func(change Change) (finding string, note string) {
325-
finding = "Do you have the right bug reference format? %s (without a period) at the end of the commit message."
325+
finding = "Do you have the right bug reference format? %s at the end of the commit message."
326326
if mightBeTrivial(change) {
327327
return "", ""
328328
}
329329
var bugPattern string
330330
switch {
331331
case change.Repo == "go":
332-
bugPattern = `#\d{4,}$`
332+
bugPattern = `#\d{4,}`
333333
case usesTracker(change.Repo) == mainTracker:
334-
bugPattern = `golang/go#\d{4,}$`
334+
bugPattern = `golang/go#\d{4,}`
335335
case usesTracker(change.Repo) == ownTracker:
336-
bugPattern = fmt.Sprintf(`golang/%s#\d{2,}$`, change.Repo)
336+
bugPattern = fmt.Sprintf(`golang/%s#\d{2,}`, change.Repo)
337337
default:
338-
bugPattern = `golang/go#\d{4,}$`
338+
bugPattern = `golang/go#\d{4,}`
339339
}
340-
if !match(`(?m)^(Fixes|Updates|For|Closes|Resolves) `+bugPattern, change.Body) {
340+
if !match(`(?m)^(Fixes|Updates|For|Closes|Resolves) `+bugPattern+`\.?$`, change.Body) {
341341
return fmt.Sprintf(finding, bugExamples(change.Repo)), commitMessageAdvice
342342
}
343343
return "", ""

cmd/gerritbot/internal/rules/rules_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To edit the commit message, see instructions [here](https://github.com/golang/go
4141
want: `Possible problems detected:
4242
1. The commit title should start with the primary affected component name followed by a colon, like "src/goInstallTools: improve [...]".
4343
2. The first word in the commit title after the component should be a lowercase English word (usually a verb).
44-
3. Do you have the right bug reference format? For the vscode-go repo, the format is usually 'Fixes golang/vscode-go#1234' or 'Updates golang/vscode-go#1234' (without a period) at the end of the commit message.
44+
3. Do you have the right bug reference format? For the vscode-go repo, the format is usually 'Fixes golang/vscode-go#1234' or 'Updates golang/vscode-go#1234' at the end of the commit message.
4545
4646
To edit the commit message, see instructions [here](https://github.com/golang/go/wiki/GerritBot/#how-does-gerritbot-determine-the-final-commit-message). For guidelines on commit messages for the Go project, see [here](https://go.dev/doc/contribute#commit_messages).
4747
`,

0 commit comments

Comments
 (0)