Skip to content

Commit

Permalink
Fix some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Oct 11, 2020
1 parent 2de7342 commit bb5491a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions prow/plugins/lgtm/lgtm.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,23 +279,23 @@ func handle(wantLGTM bool, config *plugins.Configuration, ownersClient repoowner
// check if skip collaborators is enabled for this org/repo
skipCollaborators := skipCollaborators(config, org, repoName)

// check if the commentor is a collaborator
// check if the commenter is a collaborator
isCollaborator, err := gc.IsCollaborator(org, repoName, author)
if err != nil {
log.WithError(err).Error("Failed to check if author is a collaborator.")
return err // abort if we can't determine if commentor is a collaborator
return err // abort if we can't determine if commenter is a collaborator
}

// if commentor isn't a collaborator, and we care about collaborators, abort
// if commenter isn't a collaborator, and we care about collaborators, abort
if !isAuthor && !skipCollaborators && !isCollaborator {
resp := "changing LGTM is restricted to collaborators"
log.Infof("Reply to /lgtm request with comment: \"%s\"", resp)
return gc.CreateComment(org, repoName, number, plugins.FormatResponseRaw(body, htmlURL, author, resp))
}

// either ensure that the commentor is a collaborator or an approver/reviewer
// either ensure that the commenter is a collaborator or an approver/reviewer
if !isAuthor && !isAssignee && !skipCollaborators {
// in this case we need to ensure the commentor is assignable to the PR
// in this case we need to ensure the commenter is assignable to the PR
// by assigning them
log.Infof("Assigning %s/%s#%d to %s", org, repoName, number, author)
if err := gc.AssignIssue(org, repoName, number, []string{author}); err != nil {
Expand All @@ -321,7 +321,7 @@ func handle(wantLGTM bool, config *plugins.Configuration, ownersClient repoowner
}

// now we update the LGTM labels, having checked all cases where changing
// LGTM was not allowed for the commentor
// LGTM was not allowed for the commenter

// Only add the label if it doesn't have it, and vice versa.
labels, err := gc.GetIssueLabels(org, repoName, number)
Expand Down Expand Up @@ -429,7 +429,7 @@ func handlePullRequest(log *logrus.Entry, gc githubClient, config *plugins.Confi
if opts.StoreTreeHash {
// Check if we have a tree-hash comment
var lastLgtmTreeHash string
botname, err := gc.BotName()
botName, err := gc.BotName()
if err != nil {
return err
}
Expand All @@ -442,7 +442,7 @@ func handlePullRequest(log *logrus.Entry, gc githubClient, config *plugins.Confi
for i := len(comments) - 1; i >= 0; i-- {
comment := comments[i]
m := addLGTMLabelNotificationRe.FindStringSubmatch(comment.Body)
if comment.User.Login == botname && m != nil && comment.UpdatedAt.Equal(comment.CreatedAt) {
if comment.User.Login == botName && m != nil && comment.UpdatedAt.Equal(comment.CreatedAt) {
lastLgtmTreeHash = m[1]
break
}
Expand Down

0 comments on commit bb5491a

Please sign in to comment.