-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Run gopls modernize
on codebase
#34751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test failure |
break | ||
} | ||
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) { | ||
matched = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be break
directly here.
break | ||
} | ||
if slices.ContainsFunc(actions, glob.MustCompile(val, '/').Match) { | ||
matched = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above
BTW feel free to push any changes directly to this branch. |
isCurDBTypeSupported = true | ||
break | ||
} | ||
if slices.Contains(setting.SupportedDatabaseTypes, curDBType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 4 lines could be merged.
find = true | ||
break | ||
} | ||
if slices.Contains(loadRepoIDs, result.RepoID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge the 4 lines
} | ||
expectedIssueCount := min( | ||
// from the fixtures | ||
20, setting.UI.IssuePagingNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting is not ideal, I will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @lunny, otherwise LGTM
Please wait for Refactor some file edit related code #34744 , otherwise there will be huge conflicts which are difficult to resolve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's large enough, and the auto-fixed code is good enough.
Let's leave the manual fixes to the future, to avoid introducing regressions.
} | ||
expectedIssueCount := min( | ||
// from the fixtures | ||
20, setting.UI.IssuePagingNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark another manual fix (let's do in the following up PRs)
} | ||
expectedIssueCount := min( | ||
// from the fixtures | ||
20, setting.UI.IssuePagingNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark
} | ||
expectedIssueCount := min( | ||
// from the fixtures | ||
20, setting.UI.IssuePagingNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark
break | ||
} | ||
if slices.Contains(loadRepoIDs, result.RepoID) { | ||
find = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark
@@ -149,8 +149,8 @@ func loadMarkupFrom(rootCfg ConfigProvider) { | |||
func newMarkupSanitizer(name string, sec ConfigSection) { | |||
rule, ok := createMarkupSanitizerRule(name, sec) | |||
if ok { | |||
if strings.HasPrefix(name, "sanitizer.") { | |||
names := strings.SplitN(strings.TrimPrefix(name, "sanitizer."), ".", 2) | |||
if after, ok0 := strings.CutPrefix(name, "sanitizer."); ok0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark
maybe we can use this tool in ci steps? |
gopls is slow enough. |
* giteaofficial/main: Remove unused param `doer` (go-gitea#34545) Improve alignment of commit status icon on commit page (go-gitea#34750) Run `gopls modernize` on codebase (go-gitea#34751) Refactor some file edit related code (go-gitea#34744) [skip ci] Updated translations via Crowdin Fix ghost user in feeds when pushing in an actions, it should be gitea-actions (go-gitea#34703) upgrade orgmode to v1.8.0 (go-gitea#34721) Support title and body query parameters for new PRs (go-gitea#34537) Improve nuget/rubygems package registries (go-gitea#34741) Replace update repository function in some places (go-gitea#34566) remove unnecessary duplicate code (go-gitea#34733) fix: prevent double markdown link brackets when pasting URL (go-gitea#34745) Fix JS error for "select" dropdown (go-gitea#34743) [skip ci] Updated translations via Crowdin Allow renaming/moving binary/LFS files in the UI (go-gitea#34350) Clean bindata (go-gitea#34728) Refactor container and UI (go-gitea#34736) Prevent duplicate form submissions when creating forks (go-gitea#34714)
Yes that is the plan, at least as a initial lint-only step. Once we upgrade gopls, the
Yes, |
Continue #33739. I ran modernize 3 times until it had nothing to fix, followed by fmt and fixed one lint issue. 🙏 that CI passes.
Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize