format with gofumpt (#18184)

* gofumpt -w -l .

* gofumpt -w -l -extra .

* Add linter

* manual fix

* change make fmt
This commit is contained in:
6543 2022-01-20 18:46:10 +01:00 committed by GitHub
parent 1d98d205f5
commit 54e9ee37a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
423 changed files with 1585 additions and 1758 deletions

View file

@ -25,9 +25,7 @@ type actionNotifier struct {
base.NullNotifier
}
var (
_ base.Notifier = &actionNotifier{}
)
var _ base.Notifier = &actionNotifier{}
// NewNotifier create a new actionNotifier notifier
func NewNotifier() base.Notifier {
@ -220,7 +218,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
return
}
var actions = make([]*models.Action, 0, 10)
actions := make([]*models.Action, 0, 10)
for _, lines := range review.CodeComments {
for _, comments := range lines {
for _, comm := range comments {

View file

@ -14,14 +14,12 @@ import (
// Notifier defines an interface to notify receiver
type Notifier interface {
Run()
NotifyCreateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository)
NotifyMigrateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository)
NotifyCreateRepository(doer, u *user_model.User, repo *repo_model.Repository)
NotifyMigrateRepository(doer, u *user_model.User, repo *repo_model.Repository)
NotifyDeleteRepository(doer *user_model.User, repo *repo_model.Repository)
NotifyForkRepository(doer *user_model.User, oldRepo, repo *repo_model.Repository)
NotifyRenameRepository(doer *user_model.User, repo *repo_model.Repository, oldRepoName string)
NotifyTransferRepository(doer *user_model.User, repo *repo_model.Repository, oldOwnerName string)
NotifyNewIssue(issue *models.Issue, mentions []*user_model.User)
NotifyIssueChangeStatus(*user_model.User, *models.Issue, *models.Comment, bool)
NotifyIssueChangeMilestone(doer *user_model.User, issue *models.Issue, oldMilestoneID int64)
@ -32,8 +30,7 @@ type Notifier interface {
NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string)
NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldRef string)
NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
addedLabels []*models.Label, removedLabels []*models.Label)
addedLabels, removedLabels []*models.Label)
NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User)
NotifyMergePullRequest(*models.PullRequest, *user_model.User)
NotifyPullRequestSynchronized(doer *user_model.User, pr *models.PullRequest)
@ -42,23 +39,18 @@ type Notifier interface {
NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *models.PullRequest, oldBranch string)
NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment)
NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment)
NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
issue *models.Issue, comment *models.Comment, mentions []*user_model.User)
NotifyUpdateComment(*user_model.User, *models.Comment, string)
NotifyDeleteComment(*user_model.User, *models.Comment)
NotifyNewRelease(rel *models.Release)
NotifyUpdateRelease(doer *user_model.User, rel *models.Release)
NotifyDeleteRelease(doer *user_model.User, rel *models.Release)
NotifyPushCommits(pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits)
NotifyCreateRef(doer *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string)
NotifyDeleteRef(doer *user_model.User, repo *repo_model.Repository, refType, refFullName string)
NotifySyncPushCommits(pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits)
NotifySyncCreateRef(doer *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string)
NotifySyncDeleteRef(doer *user_model.User, repo *repo_model.Repository, refType, refFullName string)
NotifyRepoPendingTransfer(doer, newOwner *user_model.User, repo *repo_model.Repository)
}

View file

@ -12,12 +12,9 @@ import (
)
// NullNotifier implements a blank notifier
type NullNotifier struct {
}
type NullNotifier struct{}
var (
_ Notifier = &NullNotifier{}
)
var _ Notifier = &NullNotifier{}
// Run places a place holder function
func (*NullNotifier) Run() {
@ -118,7 +115,7 @@ func (*NullNotifier) NotifyIssueChangeRef(doer *user_model.User, issue *models.I
// NotifyIssueChangeLabels places a place holder function
func (*NullNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
addedLabels []*models.Label, removedLabels []*models.Label) {
addedLabels, removedLabels []*models.Label) {
}
// NotifyCreateRepository places a place holder function

View file

@ -22,9 +22,7 @@ type indexerNotifier struct {
base.NullNotifier
}
var (
_ base.Notifier = &indexerNotifier{}
)
var _ base.Notifier = &indexerNotifier{}
// NewNotifier create a new indexerNotifier notifier
func NewNotifier() base.Notifier {

View file

@ -21,9 +21,7 @@ type mailNotifier struct {
base.NullNotifier
}
var (
_ base.Notifier = &mailNotifier{}
)
var _ base.Notifier = &mailNotifier{}
// NewNotifier create a new mailNotifier notifier
func NewNotifier() base.Notifier {

View file

@ -18,9 +18,7 @@ import (
"code.gitea.io/gitea/modules/setting"
)
var (
notifiers []base.Notifier
)
var notifiers []base.Notifier
// RegisterNotifier providers method to receive notify messages
func RegisterNotifier(notifier base.Notifier) {
@ -203,7 +201,7 @@ func NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldRef str
// NotifyIssueChangeLabels notifies change labels to notifiers
func NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
addedLabels []*models.Label, removedLabels []*models.Label) {
addedLabels, removedLabels []*models.Label) {
for _, notifier := range notifiers {
notifier.NotifyIssueChangeLabels(doer, issue, addedLabels, removedLabels)
}

View file

@ -29,9 +29,7 @@ type (
}
)
var (
_ base.Notifier = &notificationService{}
)
var _ base.Notifier = &notificationService{}
// NewNotifier create a new notificationService notifier
func NewNotifier() base.Notifier {
@ -55,7 +53,7 @@ func (ns *notificationService) Run() {
func (ns *notificationService) NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
issue *models.Issue, comment *models.Comment, mentions []*user_model.User) {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: issue.ID,
NotificationAuthorID: doer.ID,
}
@ -64,7 +62,7 @@ func (ns *notificationService) NotifyCreateIssueComment(doer *user_model.User, r
}
_ = ns.issueQueue.Push(opts)
for _, mention := range mentions {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: issue.ID,
NotificationAuthorID: doer.ID,
ReceiverID: mention.ID,
@ -153,7 +151,7 @@ func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, ment
}
func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, c *models.Comment, mentions []*user_model.User) {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: pr.Issue.ID,
NotificationAuthorID: r.Reviewer.ID,
}
@ -162,7 +160,7 @@ func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r
}
_ = ns.issueQueue.Push(opts)
for _, mention := range mentions {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: pr.Issue.ID,
NotificationAuthorID: r.Reviewer.ID,
ReceiverID: mention.ID,
@ -186,7 +184,7 @@ func (ns *notificationService) NotifyPullRequestCodeComment(pr *models.PullReque
}
func (ns *notificationService) NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment) {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: pr.IssueID,
NotificationAuthorID: doer.ID,
CommentID: comment.ID,
@ -195,7 +193,7 @@ func (ns *notificationService) NotifyPullRequestPushCommits(doer *user_model.Use
}
func (ns *notificationService) NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: review.IssueID,
NotificationAuthorID: doer.ID,
CommentID: comment.ID,
@ -205,7 +203,7 @@ func (ns *notificationService) NotifyPullRevieweDismiss(doer *user_model.User, r
func (ns *notificationService) NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
if !removed {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: issue.ID,
NotificationAuthorID: doer.ID,
ReceiverID: assignee.ID,
@ -221,7 +219,7 @@ func (ns *notificationService) NotifyIssueChangeAssignee(doer *user_model.User,
func (ns *notificationService) NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment) {
if isRequest {
var opts = issueNotificationOpts{
opts := issueNotificationOpts{
IssueID: issue.ID,
NotificationAuthorID: doer.ID,
ReceiverID: reviewer.ID,

View file

@ -29,9 +29,7 @@ type webhookNotifier struct {
base.NullNotifier
}
var (
_ base.Notifier = &webhookNotifier{}
)
var _ base.Notifier = &webhookNotifier{}
// NewNotifier create a new webhookNotifier notifier
func NewNotifier() base.Notifier {
@ -497,11 +495,10 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *user_model.User, comment *mo
if err != nil {
log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
}
}
func (m *webhookNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
addedLabels []*models.Label, removedLabels []*models.Label) {
addedLabels, removedLabels []*models.Label) {
ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueChangeLabels User: %s[%d] Issue[%d] #%d in [%d]", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID))
defer finished()