1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

enable staticcheck QFxxxx rules (#34064)

This commit is contained in:
TheFox0x7
2025-03-29 22:32:28 +01:00
committed by GitHub
parent 5564c39105
commit 2a59dfbd47
47 changed files with 179 additions and 143 deletions

View File

@@ -938,9 +938,10 @@ func ExcerptBlob(ctx *context.Context) {
RightHunkSize: rightHunkSize,
},
}
if direction == "up" {
switch direction {
case "up":
section.Lines = append([]*gitdiff.DiffLine{lineSection}, section.Lines...)
} else if direction == "down" {
case "down":
section.Lines = append(section.Lines, lineSection)
}
}

View File

@@ -157,15 +157,16 @@ func GetContentHistoryDetail(ctx *context.Context) {
diffHTMLBuf := bytes.Buffer{}
diffHTMLBuf.WriteString("<pre class='chroma'>")
for _, it := range diff {
if it.Type == diffmatchpatch.DiffInsert {
switch it.Type {
case diffmatchpatch.DiffInsert:
diffHTMLBuf.WriteString("<span class='gi'>")
diffHTMLBuf.WriteString(html.EscapeString(it.Text))
diffHTMLBuf.WriteString("</span>")
} else if it.Type == diffmatchpatch.DiffDelete {
case diffmatchpatch.DiffDelete:
diffHTMLBuf.WriteString("<span class='gd'>")
diffHTMLBuf.WriteString(html.EscapeString(it.Text))
diffHTMLBuf.WriteString("</span>")
} else {
default:
diffHTMLBuf.WriteString(html.EscapeString(it.Text))
}
}

View File

@@ -696,9 +696,10 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
return 0
}
reviewTyp := issues_model.ReviewTypeApprove
if typ == "reject" {
switch typ {
case "reject":
reviewTyp = issues_model.ReviewTypeReject
} else if typ == "waiting" {
case "waiting":
reviewTyp = issues_model.ReviewTypeRequest
}
for _, count := range counts {

View File

@@ -209,11 +209,12 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori
return user_service.CanBlockUser(ctx, ctx.Doer, blocker, blockee)
}
if origin == "diff" {
switch origin {
case "diff":
ctx.HTML(http.StatusOK, tplDiffConversation)
} else if origin == "timeline" {
case "timeline":
ctx.HTML(http.StatusOK, tplTimelineConversation)
} else {
default:
ctx.HTTPError(http.StatusBadRequest, "Unknown origin: "+origin)
}
}