Skip to content

Commit ef8ed90

Browse files
committed
Warn about targetting stable for PRs with the 'ICE' keyword
1 parent 1faff8b commit ef8ed90

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

source/dlangbot/warnings.d

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ void checkBugzilla(in ref PullRequest pr, ref UserMessage[] msgs,
3232
if (pr.base.ref_ != "stable")
3333
{
3434
if (bugzillaIssues.any!(i => i.status.among("NEW", "ASSIGNED", "REOPENED") &&
35-
i.severity.among("critical", "blocker", "regression") &&
35+
(i.severity.among("critical", "blocker", "regression") ||
36+
i.keywords.splitter(", ").canFind("ice")) &&
3637
refs.canFind!(r => r.id == i.id && r.fixed)))
3738
{
3839
msgs ~= UserMessage(UserMessage.Type.Warning,

test/comments.d

+62-2
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ unittest
436436
(scope HTTPServerRequest req, scope HTTPServerResponse res){
437437
assert(req.method == HTTPMethod.DELETE);
438438
},
439-
"/github/repos/dlang/phobos/issues/4921/comments",
439+
"/github/repos/dlang/phobos/issues/4921/comments",
440440
"/github/orgs/dlang/public_members?per_page=100",
441-
"/github/repos/dlang/phobos/issues/comments/262784442",
441+
"/github/repos/dlang/phobos/issues/comments/262784442",
442442
(scope HTTPServerRequest req, scope HTTPServerResponse res){
443443
assert(req.method == HTTPMethod.PATCH);
444444
auto body_ = req.json["body"].get!string;
@@ -450,3 +450,63 @@ unittest
450450
postGitHubHook("dlang_phobos_synchronize_4921.json");
451451
}
452452
}
453+
454+
@("warn-for-ices")
455+
unittest
456+
{
457+
auto d = Disable!("runTrello", "runBugzillaUpdates")(0);
458+
459+
setAPIExpectations(
460+
"/github/repos/dlang/phobos/pulls/4921/commits", (ref Json j) {
461+
j[0]["commit"]["message"] = "Issue 19296";
462+
},
463+
"/github/repos/dlang/phobos/issues/4921/labels",
464+
"/github/repos/dlang/phobos/issues/4921/comments", (ref Json j) {
465+
j = Json.emptyArray;
466+
},
467+
"/bugzilla/buglist.cgi?bug_id=19296&ctype=csv&columnlist=short_desc,bug_status,resolution,bug_severity,priority,keywords",
468+
(scope HTTPServerRequest req, scope HTTPServerResponse res){
469+
res.writeBody(
470+
`bug_id,"short_desc","bug_status","resolution","bug_severity","priority","keywords"
471+
19296,"ICE on Unknown member type in struct returned from function","NEW"," ---","normal","P1","ice"`);
472+
},
473+
"/github/orgs/dlang/public_members?per_page=100",
474+
"/github/repos/dlang/phobos/issues/4921/comments",
475+
(scope HTTPServerRequest req, scope HTTPServerResponse res){
476+
assert(req.method == HTTPMethod.POST);
477+
assert(!req.json["body"].get!string.canFind("Regression or critical bug fixes"));
478+
},
479+
);
480+
481+
postGitHubHook("dlang_phobos_synchronize_4921.json");
482+
}
483+
484+
@("warn-for-ices-multiple-keywords")
485+
unittest
486+
{
487+
auto d = Disable!("runTrello", "runBugzillaUpdates")(0);
488+
489+
setAPIExpectations(
490+
"/github/repos/dlang/phobos/pulls/4921/commits", (ref Json j) {
491+
j[0]["commit"]["message"] = "Issue 19296";
492+
},
493+
"/github/repos/dlang/phobos/issues/4921/labels",
494+
"/github/repos/dlang/phobos/issues/4921/comments", (ref Json j) {
495+
j = Json.emptyArray;
496+
},
497+
"/bugzilla/buglist.cgi?bug_id=19296&ctype=csv&columnlist=short_desc,bug_status,resolution,bug_severity,priority,keywords",
498+
(scope HTTPServerRequest req, scope HTTPServerResponse res){
499+
res.writeBody(
500+
`bug_id,"short_desc","bug_status","resolution","bug_severity","priority","keywords"
501+
19296,"ICE on Unknown member type in struct returned from function","NEW"," ---","normal","P1","foo, ice, bar"`);
502+
},
503+
"/github/orgs/dlang/public_members?per_page=100",
504+
"/github/repos/dlang/phobos/issues/4921/comments",
505+
(scope HTTPServerRequest req, scope HTTPServerResponse res){
506+
assert(req.method == HTTPMethod.POST);
507+
assert(!req.json["body"].get!string.canFind("Regression or critical bug fixes"));
508+
},
509+
);
510+
511+
postGitHubHook("dlang_phobos_synchronize_4921.json");
512+
}

0 commit comments

Comments
 (0)