aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2024-04-22 13:48:42 +0200
committerGitHub <noreply@github.com>2024-04-22 11:48:42 +0000
commit74f0c84fa4245a20ce6fb87dac1faf2aeeded2a2 (patch)
tree94b0356bea5ad1cd24a523947cf001509a973be1 /routers/web/repo
parentaff7b7bdd285cc1fcabea774f153886e11ae9f5d (diff)
downloadgitea-74f0c84fa4245a20ce6fb87dac1faf2aeeded2a2.tar.gz
gitea-74f0c84fa4245a20ce6fb87dac1faf2aeeded2a2.zip
Enable more `revive` linter rules (#30608)
Noteable additions: - `redefines-builtin-id` forbid variable names that shadow go builtins - `empty-lines` remove unnecessary empty lines that `gofumpt` does not remove for some reason - `superfluous-else` eliminate more superfluous `else` branches Rules are also sorted alphabetically and I cleaned up various parts of `.golangci.yml`.
Diffstat (limited to 'routers/web/repo')
-rw-r--r--routers/web/repo/actions/view.go1
-rw-r--r--routers/web/repo/issue.go4
-rw-r--r--routers/web/repo/pull.go3
-rw-r--r--routers/web/repo/pull_review.go1
-rw-r--r--routers/web/repo/view.go1
5 files changed, 0 insertions, 10 deletions
diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go
index 41989589be..db2b11a7ed 100644
--- a/routers/web/repo/actions/view.go
+++ b/routers/web/repo/actions/view.go
@@ -644,7 +644,6 @@ func ArtifactsDownloadView(ctx *context_module.Context) {
writer := zip.NewWriter(ctx.Resp)
defer writer.Close()
for _, art := range artifacts {
-
f, err := storage.ActionsArtifacts.Open(art.StoragePath)
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 1364d75676..95f0cf3d71 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -933,7 +933,6 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles
}
}
}
-
}
if template.Ref != "" && !strings.HasPrefix(template.Ref, "refs/") { // Assume that the ref intended is always a branch - for tags users should use refs/tags/<ref>
@@ -1681,7 +1680,6 @@ func ViewIssue(ctx *context.Context) {
if comment.ProjectID > 0 && comment.Project == nil {
comment.Project = ghostProject
}
-
} else if comment.Type == issues_model.CommentTypeAssignees || comment.Type == issues_model.CommentTypeReviewRequest {
if err = comment.LoadAssigneeUserAndTeam(ctx); err != nil {
ctx.ServerError("LoadAssigneeUserAndTeam", err)
@@ -2610,7 +2608,6 @@ func SearchIssues(ctx *context.Context) {
var includedAnyLabels []int64
{
-
labels := ctx.FormTrim("labels")
var includedLabelNames []string
if len(labels) > 0 {
@@ -2994,7 +2991,6 @@ func NewComment(ctx *context.Context) {
if (ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) || (ctx.IsSigned && issue.IsPoster(ctx.Doer.ID))) &&
(form.Status == "reopen" || form.Status == "close") &&
!(issue.IsPull && issue.PullRequest.HasMerged) {
-
// Duplication and conflict check should apply to reopen pull request.
var pr *issues_model.PullRequest
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index a0a8e5410c..71f25db11b 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -443,7 +443,6 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
}
if pb != nil && pb.EnableStatusCheck {
-
var missingRequiredChecks []string
for _, requiredContext := range pb.StatusCheckContexts {
contextFound := false
@@ -646,7 +645,6 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
// Validate the given commit sha to show (if any passed)
if willShowSpecifiedCommit || willShowSpecifiedCommitRange {
-
foundStartCommit := len(specifiedStartCommit) == 0
foundEndCommit := len(specifiedEndCommit) == 0
@@ -974,7 +972,6 @@ func UpdatePullRequest(ctx *context.Context) {
ctx.Flash.Error(flashError)
ctx.Redirect(issue.Link())
return
-
}
ctx.Flash.Error(err.Error())
ctx.Redirect(issue.Link())
diff --git a/routers/web/repo/pull_review.go b/routers/web/repo/pull_review.go
index c8d149a482..a65d4866d0 100644
--- a/routers/web/repo/pull_review.go
+++ b/routers/web/repo/pull_review.go
@@ -318,7 +318,6 @@ func UpdateViewedFiles(ctx *context.Context) {
updatedFiles := make(map[string]pull_model.ViewedState, len(data.Files))
for file, viewed := range data.Files {
-
// Only unviewed and viewed are possible, has-changed can not be set from the outside
state := pull_model.Unviewed
if viewed {
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 9c1f4faa5f..e4e6201c24 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -347,7 +347,6 @@ func loadLatestCommitData(ctx *context.Context, latestCommit *git.Commit) bool {
// or of directory if not in root directory.
ctx.Data["LatestCommit"] = latestCommit
if latestCommit != nil {
-
verification := asymkey_model.ParseCommitWithSignature(ctx, latestCommit)
if err := asymkey_model.CalculateTrustStatus(verification, ctx.Repo.Repository.GetTrustModel(), func(user *user_model.User) (bool, error) {