Sfoglia il codice sorgente

Added Post functions comment 'GoLint'

Yoginth 7 anni fa
parent
commit
e16d27c592

+ 2 - 0
routes/repo/branch.go

@@ -26,6 +26,7 @@ const (
 	BranchesAllTPL = "repo/branches/all"
 )
 
+// Branch contains the branch information
 type Branch struct {
 	Name        string
 	Commit      *git.Commit
@@ -113,6 +114,7 @@ func AllBranches(c *context.Context) {
 	c.HTML(200, BranchesAllTPL)
 }
 
+// DeleteBranchPost deletes a branch
 func DeleteBranchPost(c *context.Context) {
 	branchName := c.Params("*")
 	commitID := c.Query("commit")

+ 3 - 0
routes/repo/commit.go

@@ -46,6 +46,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
 	return newCommits
 }
 
+// renderCommits shows commits page
 func renderCommits(c *context.Context, filename string) {
 	c.Data["Title"] = c.Tr("repo.commits.commit_history") + " · " + c.Repo.Repository.FullName()
 	c.Data["PageIsCommits"] = true
@@ -95,6 +96,7 @@ func Commits(c *context.Context) {
 	renderCommits(c, "")
 }
 
+// SearchCommits shows search commits page
 func SearchCommits(c *context.Context) {
 	c.Data["PageIsCommits"] = true
 
@@ -124,6 +126,7 @@ func FileHistory(c *context.Context) {
 	renderCommits(c, c.Repo.TreePath)
 }
 
+// Diff shows diff page
 func Diff(c *context.Context) {
 	c.RequireHighlightJS()
 	c.RequireHighlightJS()

+ 10 - 0
routes/repo/editor.go

@@ -53,6 +53,7 @@ func getParentTreeFields(treePath string) (treeNames []string, treePaths []strin
 	return treeNames, treePaths
 }
 
+// editFile shows edit file page
 func editFile(c *context.Context, isNewFile bool) {
 	c.PageIs("Edit")
 	c.RequireHighlightJS()
@@ -126,10 +127,12 @@ func editFile(c *context.Context, isNewFile bool) {
 	c.Success(EditFileTPL)
 }
 
+// EditFile shows edit file page
 func EditFile(c *context.Context) {
 	editFile(c, false)
 }
 
+// NewFile shows new file page
 func NewFile(c *context.Context) {
 	editFile(c, true)
 }
@@ -298,14 +301,17 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) {
 	}
 }
 
+// EditFilePost edits a file
 func EditFilePost(c *context.Context, f form.EditRepoFile) {
 	editFilePost(c, f, false)
 }
 
+// NewFilePost creates a new file
 func NewFilePost(c *context.Context, f form.EditRepoFile) {
 	editFilePost(c, f, true)
 }
 
+// DiffPreviewPost previews a diff
 func DiffPreviewPost(c *context.Context, f form.EditPreviewDiff) {
 	treePath := c.Repo.TreePath
 
@@ -333,6 +339,7 @@ func DiffPreviewPost(c *context.Context, f form.EditPreviewDiff) {
 	c.HTML(200, EditDiffPreviewTPL)
 }
 
+// DeleteFile shows delete file page
 func DeleteFile(c *context.Context) {
 	c.PageIs("Delete")
 	c.Data["BranchLink"] = c.Repo.RepoLink + "/src/" + c.Repo.BranchName
@@ -344,6 +351,7 @@ func DeleteFile(c *context.Context) {
 	c.Success(DeleteFileTPL)
 }
 
+// DeleteFilePost deletes a file
 func DeleteFilePost(c *context.Context, f form.DeleteRepoFile) {
 	c.PageIs("Delete")
 	c.Data["BranchLink"] = c.Repo.RepoLink + "/src/" + c.Repo.BranchName
@@ -409,6 +417,7 @@ func renderUploadSettings(c *context.Context) {
 	c.Data["UploadMaxFiles"] = setting.Repository.Upload.MaxFiles
 }
 
+// UploadFile shows upload file page
 func UploadFile(c *context.Context) {
 	c.PageIs("Upload")
 	renderUploadSettings(c)
@@ -429,6 +438,7 @@ func UploadFile(c *context.Context) {
 	c.Success(UploadFileTPL)
 }
 
+// UploadFilePost uploads a file
 func UploadFilePost(c *context.Context, f form.UploadRepoFile) {
 	c.PageIs("Upload")
 	renderUploadSettings(c)

+ 1 - 0
routes/repo/http.go

@@ -29,6 +29,7 @@ import (
 	"gopkg.in/macaron.v1"
 )
 
+// HTTPContext contains the HTTP context information
 type HTTPContext struct {
 	*context.Context
 	OwnerName string

+ 3 - 0
routes/repo/issue.go

@@ -429,6 +429,7 @@ func ValidateRepoMetas(c *context.Context, f form.NewIssue) ([]int64, int64, int
 	return labelIDs, milestoneID, assigneeID
 }
 
+// NewIssuePost creates a new issue
 func NewIssuePost(c *context.Context, f form.NewIssue) {
 	c.Data["Title"] = c.Tr("repo.issues.new")
 	c.Data["PageIsIssueList"] = true
@@ -1147,6 +1148,7 @@ func NewMilestone(c *context.Context) {
 	c.HTML(200, MilestoneNewTPL)
 }
 
+// NewMilestonePost creates a new milestone
 func NewMilestonePost(c *context.Context, f form.CreateMilestone) {
 	c.Data["Title"] = c.Tr("repo.milestones.new")
 	c.Data["PageIsIssueList"] = true
@@ -1207,6 +1209,7 @@ func EditMilestone(c *context.Context) {
 	c.HTML(200, MilestoneNewTPL)
 }
 
+// EditMilestonePost edits a milestone
 func EditMilestonePost(c *context.Context, f form.CreateMilestone) {
 	c.Data["Title"] = c.Tr("repo.milestones.edit")
 	c.Data["PageIsMilestones"] = true

+ 2 - 0
routes/repo/pull.go

@@ -90,6 +90,7 @@ func Fork(c *context.Context) {
 	c.Success(ForkTPL)
 }
 
+// ForkPost forks a repo
 func ForkPost(c *context.Context, f form.CreateRepo) {
 	c.Data["Title"] = c.Tr("new_fork")
 
@@ -648,6 +649,7 @@ func CompareAndPullRequest(c *context.Context) {
 	c.Success(ComparePullTPL)
 }
 
+// CompareAndPullRequestPost compares branches/forks and create a new pull request
 func CompareAndPullRequestPost(c *context.Context, f form.NewIssue) {
 	c.Data["Title"] = c.Tr("repo.pulls.compare_changes")
 	c.Data["PageIsComparePull"] = true

+ 2 - 0
routes/repo/release.go

@@ -169,6 +169,7 @@ func NewRelease(c *context.Context) {
 	c.HTML(200, ReleasesNewTPL)
 }
 
+// NewReleasePost creates a new release
 func NewReleasePost(c *context.Context, f form.NewRelease) {
 	c.Data["Title"] = c.Tr("repo.release.new_release")
 	c.Data["PageIsReleaseList"] = true
@@ -269,6 +270,7 @@ func EditRelease(c *context.Context) {
 	c.HTML(200, ReleasesNewTPL)
 }
 
+// EditReleasePost edits a release
 func EditReleasePost(c *context.Context, f form.EditRelease) {
 	c.Data["Title"] = c.Tr("repo.release.edit_release")
 	c.Data["PageIsReleaseList"] = true

+ 2 - 0
routes/repo/repo.go

@@ -108,6 +108,7 @@ func handleCreateError(c *context.Context, owner *models.User, err error, name,
 	}
 }
 
+// CreatePost creates a new repo
 func CreatePost(c *context.Context, f form.CreateRepo) {
 	c.Data["Title"] = c.Tr("new_repo")
 
@@ -166,6 +167,7 @@ func Migrate(c *context.Context) {
 	c.HTML(200, MigrateTPL)
 }
 
+// MigratePost creates a new repo migration
 func MigratePost(c *context.Context, f form.MigrateRepo) {
 	c.Data["Title"] = c.Tr("new_migrate")
 

+ 6 - 0
routes/repo/setting.go

@@ -58,6 +58,7 @@ func Settings(c *context.Context) {
 	c.Success(SettingsOptionsTPL)
 }
 
+// SettingsPost updates settings
 func SettingsPost(c *context.Context, f form.RepoSetting) {
 	c.Title("repo.settings")
 	c.PageIs("SettingsOptions")
@@ -323,6 +324,7 @@ func SettingsAvatar(c *context.Context) {
 	c.Success(SettingsRepoAvatarTPL)
 }
 
+// SettingsAvatarPost updates avatar settings
 func SettingsAvatarPost(c *context.Context, f form.Avatar) {
 	f.Source = form.AVATAR_LOCAL
 	if err := UpdateAvatarSetting(c, f, c.Repo.Repository); err != nil {
@@ -388,6 +390,7 @@ func SettingsCollaboration(c *context.Context) {
 	c.HTML(200, SettingsCollaborationTPL)
 }
 
+// SettingsCollaborationPost updates collaborator settings
 func SettingsCollaborationPost(c *context.Context) {
 	name := strings.ToLower(c.Query("collaborator"))
 	if len(name) == 0 || c.Repo.Owner.LowerName == name {
@@ -549,6 +552,7 @@ func SettingsProtectedBranch(c *context.Context) {
 	c.HTML(200, SettingsProtectedBranchTPL)
 }
 
+// SettingsProtectedBranchPost updates protected branch settings
 func SettingsProtectedBranchPost(c *context.Context, f form.ProtectBranch) {
 	branch := c.Params("*")
 	if !c.Repo.GitRepo.IsBranchExist(branch) {
@@ -620,6 +624,7 @@ func SettingsGitHooksEdit(c *context.Context) {
 	c.HTML(200, SettingsGitHookEditTPL)
 }
 
+// SettingsGitHooksEditPost updates githook settings
 func SettingsGitHooksEditPost(c *context.Context) {
 	name := c.Params(":name")
 	hook, err := c.Repo.GitRepo.GetHook(name)
@@ -653,6 +658,7 @@ func SettingsDeployKeys(c *context.Context) {
 	c.HTML(200, SettingsDeployKeysTPL)
 }
 
+// SettingsDeployKeysPost updates deploy keys settings
 func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
 	c.Data["Title"] = c.Tr("repo.settings.deploy_keys")
 	c.Data["PageIsSettingsKeys"] = true

+ 7 - 2
routes/repo/webhook.go

@@ -49,6 +49,7 @@ func Webhooks(c *context.Context) {
 	c.HTML(200, WebhooksTPL)
 }
 
+// OrgRepoCtx contains the org repo information
 type OrgRepoCtx struct {
 	OrgID       int64
 	RepoID      int64
@@ -127,6 +128,7 @@ func ParseHookEvent(f form.Webhook) *models.HookEvent {
 	}
 }
 
+// WebHooksNewPost creates new webhooks
 func WebHooksNewPost(c *context.Context, f form.NewWebhook) {
 	c.Data["Title"] = c.Tr("repo.settings.add_webhook")
 	c.Data["PageIsSettingsHooks"] = true
@@ -173,6 +175,7 @@ func WebHooksNewPost(c *context.Context, f form.NewWebhook) {
 	c.Redirect(orCtx.Link + "/settings/hooks")
 }
 
+// SlackHooksNewPost creates new slack hook
 func SlackHooksNewPost(c *context.Context, f form.NewSlackHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true
@@ -223,7 +226,7 @@ func SlackHooksNewPost(c *context.Context, f form.NewSlackHook) {
 	c.Redirect(orCtx.Link + "/settings/hooks")
 }
 
-// FIXME: merge logic to Slack
+// DiscordHooksNewPost creates new discord hook
 func DiscordHooksNewPost(c *context.Context, f form.NewDiscordHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true
@@ -326,6 +329,7 @@ func WebHooksEdit(c *context.Context) {
 	c.HTML(200, orCtx.NewTemplate)
 }
 
+// WebHooksEditPost edits webhooks
 func WebHooksEditPost(c *context.Context, f form.NewWebhook) {
 	c.Data["Title"] = c.Tr("repo.settings.update_webhook")
 	c.Data["PageIsSettingsHooks"] = true
@@ -364,6 +368,7 @@ func WebHooksEditPost(c *context.Context, f form.NewWebhook) {
 	c.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
 }
 
+// SlackHooksEditPost edits slack hooks
 func SlackHooksEditPost(c *context.Context, f form.NewSlackHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true
@@ -407,7 +412,7 @@ func SlackHooksEditPost(c *context.Context, f form.NewSlackHook) {
 	c.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
 }
 
-// FIXME: merge logic to Slack
+// DiscordHooksEditPost edits discord hooks
 func DiscordHooksEditPost(c *context.Context, f form.NewDiscordHook) {
 	c.Data["Title"] = c.Tr("repo.settings")
 	c.Data["PageIsSettingsHooks"] = true

+ 4 - 0
routes/repo/wiki.go

@@ -44,6 +44,7 @@ func MustEnableWiki(c *context.Context) {
 	}
 }
 
+// PageMeta contains the page meta information
 type PageMeta struct {
 	Name    string
 	URL     string
@@ -206,6 +207,7 @@ func NewWiki(c *context.Context) {
 	c.HTML(200, WikiNewTPL)
 }
 
+// NewWikiPost creates a new wiki
 func NewWikiPost(c *context.Context, f form.NewWiki) {
 	c.Data["Title"] = c.Tr("repo.wiki.new_page")
 	c.Data["PageIsWiki"] = true
@@ -247,6 +249,7 @@ func EditWiki(c *context.Context) {
 	c.HTML(200, WikiNewTPL)
 }
 
+// EditWikiPost edits a wiki
 func EditWikiPost(c *context.Context, f form.NewWiki) {
 	c.Data["Title"] = c.Tr("repo.wiki.new_page")
 	c.Data["PageIsWiki"] = true
@@ -265,6 +268,7 @@ func EditWikiPost(c *context.Context, f form.NewWiki) {
 	c.Redirect(c.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(models.ToWikiPageName(f.Title)))
 }
 
+// DeleteWikiPagePost deletes a wiki
 func DeleteWikiPagePost(c *context.Context) {
 	pageURL := c.Params(":page")
 	if len(pageURL) == 0 {