Fix #65 - the Dlang-Bot should use the 'Enhancement' label#84
Fix #65 - the Dlang-Bot should use the 'Enhancement' label#84PetarKirov merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request, @wilzbach! |
b9d4b9b to
05fd31b
Compare
source/dlangbot/app.d
Outdated
| import std.algorithm : canFind, filter, map, sort, uniq; | ||
| import std.array : array; | ||
| // references are already sorted by id | ||
| auto bugzillaIds = refs.map!(r => r.id).uniq.array; |
c49bc6a to
26705de
Compare
source/dlangbot/app.d
Outdated
| .map!(i => i.severity) | ||
| .array | ||
| .sort() | ||
| .uniq; |
There was a problem hiding this comment.
(This comment is obsoleted if we agree on my other one below.)
There's no need for .array.sort().uniq:
- You don't need
uniqforcanFind - Sorting is only used/needed for
uniq, since plain linear search is faster without sorting than if you sort first ( O(n) vs O(n*log(n) + log(n)) ) uniqhides the SortedRange properties, so you*findwon't perform binary search withUniqRangearrayis not needed since sorting is not needed
(Sorry for not pointing out this earlier, but I just looked at the code more thoroughly)
| if (bugzillSeverities.canFind("enhancement")) | ||
| labels ~= "Enhancement"; | ||
| else | ||
| labels ~= "Bug fix"; |
There was a problem hiding this comment.
Hmm, it seams that .array.sort.uniq.array may be needed after all.
That's because I think we need to add "Bug fix" label if there are more than one bugs attached to a PR and at least one of those bugs is not an enhancement request. Probably quite rare, and that's why I think it's worth labeling them.
if (bugzillSeverities.canFind("enhancement"))
labels ~= "Enhancement";
if (bugzillSeverities.length > 2)
labels ~= "Bug fix";
Not really sure about this. This should be very rare. Let's KISS and drop |
|
Never say never: dlang/phobos#5511 (comment) |
Rather trivial.
At this point we don't know about the existing labels, even though we have requested it before.
I will change our GH API in another PR to use internal caching and thus avoid this unnecessary request (it doesn't really hurt for now though).