mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-10 07:17:41 -05:00
Update golangci-lint to v2.6.0 (#35801)
https://github.com/golangci/golangci-lint/releases/tag/v2.6.0 - `modernize` linter is enabled, this is the same as `gopls modernize` - ~~`perfsprint` linter is disabled because it conflicts with `modernize` (maybe there is a middle ground)~~ - gocritic `deprecatedComment` is disabled as it conflicts with `go-swagger`
This commit is contained in:
@@ -14,6 +14,7 @@ linters:
|
|||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- mirror
|
- mirror
|
||||||
|
- modernize
|
||||||
- nakedret
|
- nakedret
|
||||||
- nolintlint
|
- nolintlint
|
||||||
- perfsprint
|
- perfsprint
|
||||||
@@ -55,6 +56,7 @@ linters:
|
|||||||
disabled-checks:
|
disabled-checks:
|
||||||
- ifElseChain
|
- ifElseChain
|
||||||
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
|
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
|
||||||
|
- deprecatedComment # conflicts with go-swagger comments
|
||||||
revive:
|
revive:
|
||||||
severity: error
|
severity: error
|
||||||
rules:
|
rules:
|
||||||
@@ -107,6 +109,11 @@ linters:
|
|||||||
- require-error
|
- require-error
|
||||||
usetesting:
|
usetesting:
|
||||||
os-temp-dir: true
|
os-temp-dir: true
|
||||||
|
modernize:
|
||||||
|
disable:
|
||||||
|
- stringsbuilder
|
||||||
|
perfsprint:
|
||||||
|
concat-loop: false
|
||||||
exclusions:
|
exclusions:
|
||||||
generated: lax
|
generated: lax
|
||||||
presets:
|
presets:
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -32,7 +32,7 @@ XGO_VERSION := go-1.25.x
|
|||||||
AIR_PACKAGE ?= github.com/air-verse/air@v1
|
AIR_PACKAGE ?= github.com/air-verse/air@v1
|
||||||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
|
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
|
||||||
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.9.2
|
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.9.2
|
||||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.0
|
||||||
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.15
|
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.15
|
||||||
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.7.0
|
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.7.0
|
||||||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1
|
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1
|
||||||
|
|||||||
@@ -1262,8 +1262,8 @@ func GetUserByEmail(ctx context.Context, email string) (*User, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally, if email address is the protected email address:
|
// Finally, if email address is the protected email address:
|
||||||
if strings.HasSuffix(email, "@"+setting.Service.NoReplyAddress) {
|
if before, ok := strings.CutSuffix(email, "@"+setting.Service.NoReplyAddress); ok {
|
||||||
username := strings.TrimSuffix(email, "@"+setting.Service.NoReplyAddress)
|
username := before
|
||||||
user := &User{}
|
user := &User{}
|
||||||
has, err := db.GetEngine(ctx).Where("lower_name=?", username).Get(user)
|
has, err := db.GetEngine(ctx).Where("lower_name=?", username).Get(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -129,8 +129,8 @@ func GitPathToWebPath(s string) (wp WebPath, err error) {
|
|||||||
func WebPathToUserTitle(s WebPath) (dir, display string) {
|
func WebPathToUserTitle(s WebPath) (dir, display string) {
|
||||||
dir = path.Dir(string(s))
|
dir = path.Dir(string(s))
|
||||||
display = path.Base(string(s))
|
display = path.Base(string(s))
|
||||||
if strings.HasSuffix(display, ".md") {
|
if before, ok := strings.CutSuffix(display, ".md"); ok {
|
||||||
display = strings.TrimSuffix(display, ".md")
|
display = before
|
||||||
display, _ = url.PathUnescape(display)
|
display, _ = url.PathUnescape(display)
|
||||||
}
|
}
|
||||||
display, _ = unescapeSegment(display)
|
display, _ = unescapeSegment(display)
|
||||||
|
|||||||
Reference in New Issue
Block a user