mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-22 06:17:53 +00:00
Fix remaining issues after gopls modernize
formatting (#34771)
Followup https://github.com/go-gitea/gitea/pull/34751, fix all remaining marked issues. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
a2ae7c69da
commit
46a1d52235
@ -565,18 +565,12 @@ func matchPullRequestReviewEvent(prPayload *api.PullRequestPayload, evt *jobpars
|
||||
actions = append(actions, "submitted", "edited")
|
||||
}
|
||||
|
||||
matched := false
|
||||
for _, val := range vals {
|
||||
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
|
||||
matched = true
|
||||
}
|
||||
if matched {
|
||||
matchTimes++
|
||||
break
|
||||
}
|
||||
}
|
||||
if matched {
|
||||
matchTimes++
|
||||
}
|
||||
default:
|
||||
log.Warn("pull request review event unsupported condition %q", cond)
|
||||
}
|
||||
@ -611,18 +605,12 @@ func matchPullRequestReviewCommentEvent(prPayload *api.PullRequestPayload, evt *
|
||||
actions = append(actions, "created", "edited")
|
||||
}
|
||||
|
||||
matched := false
|
||||
for _, val := range vals {
|
||||
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) {
|
||||
matched = true
|
||||
}
|
||||
if matched {
|
||||
matchTimes++
|
||||
break
|
||||
}
|
||||
}
|
||||
if matched {
|
||||
matchTimes++
|
||||
}
|
||||
default:
|
||||
log.Warn("pull request review comment event unsupported condition %q", cond)
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ func loadMarkupFrom(rootCfg ConfigProvider) {
|
||||
func newMarkupSanitizer(name string, sec ConfigSection) {
|
||||
rule, ok := createMarkupSanitizerRule(name, sec)
|
||||
if ok {
|
||||
if after, ok0 := strings.CutPrefix(name, "sanitizer."); ok0 {
|
||||
if after, found := strings.CutPrefix(name, "sanitizer."); found {
|
||||
names := strings.SplitN(after, ".", 2)
|
||||
name = names[0]
|
||||
}
|
||||
|
@ -99,11 +99,7 @@ func Install(ctx *context.Context) {
|
||||
form.SSLMode = setting.Database.SSLMode
|
||||
|
||||
curDBType := setting.Database.Type.String()
|
||||
var isCurDBTypeSupported bool
|
||||
if slices.Contains(setting.SupportedDatabaseTypes, curDBType) {
|
||||
isCurDBTypeSupported = true
|
||||
}
|
||||
if !isCurDBTypeSupported {
|
||||
if !slices.Contains(setting.SupportedDatabaseTypes, curDBType) {
|
||||
curDBType = "mysql"
|
||||
}
|
||||
ctx.Data["CurDbType"] = curDBType
|
||||
|
@ -94,11 +94,7 @@ func Code(ctx *context.Context) {
|
||||
|
||||
loadRepoIDs := make([]int64, 0, len(searchResults))
|
||||
for _, result := range searchResults {
|
||||
var find bool
|
||||
if slices.Contains(loadRepoIDs, result.RepoID) {
|
||||
find = true
|
||||
}
|
||||
if !find {
|
||||
if !slices.Contains(loadRepoIDs, result.RepoID) {
|
||||
loadRepoIDs = append(loadRepoIDs, result.RepoID)
|
||||
}
|
||||
}
|
||||
|
@ -87,11 +87,7 @@ func CodeSearch(ctx *context.Context) {
|
||||
|
||||
loadRepoIDs := make([]int64, 0, len(searchResults))
|
||||
for _, result := range searchResults {
|
||||
var find bool
|
||||
if slices.Contains(loadRepoIDs, result.RepoID) {
|
||||
find = true
|
||||
}
|
||||
if !find {
|
||||
if !slices.Contains(loadRepoIDs, result.RepoID) {
|
||||
loadRepoIDs = append(loadRepoIDs, result.RepoID)
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +267,7 @@ func TestAPISearchIssues(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
// as this API was used in the frontend, it uses UI page size
|
||||
expectedIssueCount := min(
|
||||
// from the fixtures
|
||||
20, setting.UI.IssuePagingNum)
|
||||
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||
|
||||
link, _ := url.Parse("/api/v1/repos/issues/search")
|
||||
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
|
||||
@ -370,9 +368,7 @@ func TestAPISearchIssuesWithLabels(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
// as this API was used in the frontend, it uses UI page size
|
||||
expectedIssueCount := min(
|
||||
// from the fixtures
|
||||
20, setting.UI.IssuePagingNum)
|
||||
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||
|
||||
link, _ := url.Parse("/api/v1/repos/issues/search")
|
||||
token := getUserToken(t, "user1", auth_model.AccessTokenScopeReadIssue)
|
||||
|
@ -488,9 +488,7 @@ func TestSearchIssues(t *testing.T) {
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
expectedIssueCount := min(
|
||||
// from the fixtures
|
||||
20, setting.UI.IssuePagingNum)
|
||||
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||
|
||||
link, _ := url.Parse("/issues/search")
|
||||
req := NewRequest(t, "GET", link.String())
|
||||
@ -581,9 +579,7 @@ func TestSearchIssues(t *testing.T) {
|
||||
func TestSearchIssuesWithLabels(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
expectedIssueCount := min(
|
||||
// from the fixtures
|
||||
20, setting.UI.IssuePagingNum)
|
||||
expectedIssueCount := min(20, setting.UI.IssuePagingNum) // 20 is from the fixtures
|
||||
|
||||
session := loginUser(t, "user1")
|
||||
link, _ := url.Parse("/issues/search")
|
||||
|
Loading…
Reference in New Issue
Block a user