Skip to content

Commit 7a6eb28

Browse files
author
Chris McGehee
authored
Not considering an issue as having activity if closed recently (#1531)
- The person who opened the issue can close it, so an issue closing does not indicate activity by a maintainer.
1 parent 16c0d37 commit 7a6eb28

File tree

4 files changed

+2
-50
lines changed

4 files changed

+2
-50
lines changed

checks/maintained.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,12 @@ func IsMaintained(c *checker.CheckRequest) checker.CheckResult {
8383
commitsWithinThreshold+issuesUpdatedWithinThreshold, activityPerWeek*lookBackDays/daysInOneWeek)
8484
}
8585

86-
// hasActivityByCollaboratorOrHigher returns true if there is activity by an owner/collaborator/member since the
87-
// threshold.
86+
// hasActivityByCollaboratorOrHigher returns true if the issue was created or commented on by an
87+
// owner/collaborator/member since the threshold.
8888
func hasActivityByCollaboratorOrHigher(issue *clients.Issue, threshold time.Time) bool {
8989
if issue == nil {
9090
return false
9191
}
92-
if issue.ClosedAt != nil && issue.ClosedAt.After(threshold) {
93-
// To close an issue, one must have sufficient permission in a repository, typically a collaborator or higher.
94-
return true
95-
}
9692
if isCollaboratorOrHigher(issue.AuthorAssociation) && issue.CreatedAt != nil && issue.CreatedAt.After(threshold) {
9793
// The creator of the issue is a collaborator or higher.
9894
return true

checks/maintained_test.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func TestMaintained(t *testing.T) {
3434
t.Parallel()
3535
threeHundredDaysAgo := time.Now().AddDate(0, 0, -300)
3636
twoHundredDaysAgo := time.Now().AddDate(0, 0, -200)
37-
oneHundredDaysAgo := time.Now().AddDate(0, 0, -100)
3837
fiveDaysAgo := time.Now().AddDate(0, 0, -5)
3938
oneDayAgo := time.Now().AddDate(0, 0, -1)
4039
ownerAssociation := clients.RepoAssociationOwner
@@ -262,46 +261,6 @@ func TestMaintained(t *testing.T) {
262261
Score: 1,
263262
},
264263
},
265-
{
266-
name: "old issues closed long ago",
267-
isarchived: false,
268-
commits: []clients.Commit{},
269-
issues: []clients.Issue{
270-
{
271-
CreatedAt: &threeHundredDaysAgo,
272-
AuthorAssociation: &noneAssociation,
273-
ClosedAt: &twoHundredDaysAgo,
274-
},
275-
{
276-
CreatedAt: &twoHundredDaysAgo,
277-
AuthorAssociation: &noneAssociation,
278-
ClosedAt: &oneHundredDaysAgo,
279-
},
280-
},
281-
expected: checker.CheckResult{
282-
Score: 0,
283-
},
284-
},
285-
{
286-
name: "new issues closed recently",
287-
isarchived: false,
288-
commits: []clients.Commit{},
289-
issues: []clients.Issue{
290-
{
291-
CreatedAt: &fiveDaysAgo,
292-
AuthorAssociation: &noneAssociation,
293-
ClosedAt: &oneDayAgo,
294-
},
295-
{
296-
CreatedAt: &oneDayAgo,
297-
AuthorAssociation: &noneAssociation,
298-
ClosedAt: &oneDayAgo,
299-
},
300-
},
301-
expected: checker.CheckResult{
302-
Score: 1,
303-
},
304-
},
305264
}
306265

307266
for _, tt := range tests {

clients/githubrepo/graphql.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ type graphqlData struct {
9090
Url *string
9191
AuthorAssociation *string
9292
CreatedAt *time.Time
93-
ClosedAt *time.Time
9493
Comments struct {
9594
Nodes []struct {
9695
AuthorAssociation *string
@@ -230,7 +229,6 @@ func issuesFrom(data *graphqlData) []clients.Issue {
230229
copyStringPtr(issue.Url, &tmpIssue.URI)
231230
copyRepoAssociationPtr(getRepoAssociation(issue.AuthorAssociation), &tmpIssue.AuthorAssociation)
232231
copyTimePtr(issue.CreatedAt, &tmpIssue.CreatedAt)
233-
copyTimePtr(issue.ClosedAt, &tmpIssue.ClosedAt)
234232
for _, comment := range issue.Comments.Nodes {
235233
var tmpComment clients.IssueComment
236234
copyRepoAssociationPtr(getRepoAssociation(comment.AuthorAssociation), &tmpComment.AuthorAssociation)

clients/issue.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import "time"
2020
type Issue struct {
2121
URI *string
2222
CreatedAt *time.Time
23-
ClosedAt *time.Time
2423
AuthorAssociation *RepoAssociation
2524
Comments []IssueComment
2625
}

0 commit comments

Comments
 (0)