diff --git a/modules/actions/workflows.go b/modules/actions/workflows.go index 5cdd45b046..e7677edc59 100644 --- a/modules/actions/workflows.go +++ b/modules/actions/workflows.go @@ -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) } diff --git a/modules/setting/markup.go b/modules/setting/markup.go index afaaaa2831..057b0650c3 100644 --- a/modules/setting/markup.go +++ b/modules/setting/markup.go @@ -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] } diff --git a/routers/install/install.go b/routers/install/install.go index 4b3eba78b3..b9bc41dfcf 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -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 diff --git a/routers/web/explore/code.go b/routers/web/explore/code.go index 8bde983e30..3bb50ef397 100644 --- a/routers/web/explore/code.go +++ b/routers/web/explore/code.go @@ -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) } } diff --git a/routers/web/user/code.go b/routers/web/user/code.go index 20ab1405dd..11579c40a6 100644 --- a/routers/web/user/code.go +++ b/routers/web/user/code.go @@ -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) } } diff --git a/tests/integration/api_issue_test.go b/tests/integration/api_issue_test.go index ce9c33c049..370c90a100 100644 --- a/tests/integration/api_issue_test.go +++ b/tests/integration/api_issue_test.go @@ -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) diff --git a/tests/integration/issue_test.go b/tests/integration/issue_test.go index 7b803cd54d..aff8aeda83 100644 --- a/tests/integration/issue_test.go +++ b/tests/integration/issue_test.go @@ -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")