Skip to content

Commit c666ad8

Browse files
authored
Merge branch 'main' into telackey/sort
2 parents a2e355e + e8b54d9 commit c666ad8

File tree

673 files changed

+6047
-4502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

673 files changed

+6047
-4502
lines changed

.golangci.yml

Lines changed: 149 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,172 @@
1+
version: "2"
2+
output:
3+
sort-order:
4+
- file
15
linters:
2-
enable-all: false
3-
disable-all: true
4-
fast: false
6+
default: none
57
enable:
68
- bidichk
79
- depguard
810
- dupl
911
- errcheck
1012
- forbidigo
1113
- gocritic
12-
- gofmt
13-
- gofumpt
14-
- gosimple
1514
- govet
1615
- ineffassign
16+
- mirror
1717
- nakedret
1818
- nolintlint
19+
- perfsprint
1920
- revive
2021
- staticcheck
21-
- stylecheck
2222
- testifylint
23-
- typecheck
2423
- unconvert
25-
- unused
2624
- unparam
25+
- unused
26+
- usestdlibvars
2727
- usetesting
2828
- wastedassign
29-
30-
run:
31-
timeout: 10m
32-
33-
output:
34-
sort-results: true
35-
sort-order: [file]
36-
show-stats: true
37-
38-
linters-settings:
39-
testifylint:
40-
disable:
41-
- go-require
42-
- require-error
43-
stylecheck:
44-
checks: ["all", "-ST1005", "-ST1003"]
45-
nakedret:
46-
max-func-lines: 0
47-
gocritic:
48-
disabled-checks:
49-
- ifElseChain
50-
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
51-
revive:
52-
severity: error
53-
rules:
54-
- name: atomic
55-
- name: bare-return
56-
- name: blank-imports
57-
- name: constant-logical-expr
58-
- name: context-as-argument
59-
- name: context-keys-type
60-
- name: dot-imports
61-
- name: duplicated-imports
62-
- name: empty-lines
63-
- name: error-naming
64-
- name: error-return
65-
- name: error-strings
66-
- name: errorf
67-
- name: exported
68-
- name: identical-branches
69-
- name: if-return
70-
- name: increment-decrement
71-
- name: indent-error-flow
72-
- name: modifies-value-receiver
73-
- name: package-comments
74-
- name: range
75-
- name: receiver-naming
76-
- name: redefines-builtin-id
77-
- name: string-of-int
78-
- name: superfluous-else
79-
- name: time-naming
80-
- name: unconditional-recursion
81-
- name: unexported-return
82-
- name: unreachable-code
83-
- name: var-declaration
84-
- name: var-naming
85-
gofumpt:
86-
extra-rules: true
87-
depguard:
29+
settings:
30+
depguard:
31+
rules:
32+
main:
33+
deny:
34+
- pkg: encoding/json
35+
desc: use gitea's modules/json instead of encoding/json
36+
- pkg: github.com/unknwon/com
37+
desc: use gitea's util and replacements
38+
- pkg: io/ioutil
39+
desc: use os or io instead
40+
- pkg: golang.org/x/exp
41+
desc: it's experimental and unreliable
42+
- pkg: code.gitea.io/gitea/modules/git/internal
43+
desc: do not use the internal package, use AddXxx function instead
44+
- pkg: gopkg.in/ini.v1
45+
desc: do not use the ini package, use gitea's config system instead
46+
- pkg: gitea.com/go-chi/cache
47+
desc: do not use the go-chi cache package, use gitea's cache system
48+
gocritic:
49+
disabled-checks:
50+
- ifElseChain
51+
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
52+
revive:
53+
severity: error
54+
rules:
55+
- name: atomic
56+
- name: bare-return
57+
- name: blank-imports
58+
- name: constant-logical-expr
59+
- name: context-as-argument
60+
- name: context-keys-type
61+
- name: dot-imports
62+
- name: duplicated-imports
63+
- name: empty-lines
64+
- name: error-naming
65+
- name: error-return
66+
- name: error-strings
67+
- name: errorf
68+
- name: exported
69+
- name: identical-branches
70+
- name: if-return
71+
- name: increment-decrement
72+
- name: indent-error-flow
73+
- name: modifies-value-receiver
74+
- name: package-comments
75+
- name: range
76+
- name: receiver-naming
77+
- name: redefines-builtin-id
78+
- name: string-of-int
79+
- name: superfluous-else
80+
- name: time-naming
81+
- name: unconditional-recursion
82+
- name: unexported-return
83+
- name: unreachable-code
84+
- name: var-declaration
85+
- name: var-naming
86+
staticcheck:
87+
checks:
88+
- all
89+
- -ST1003
90+
- -ST1005
91+
- -QF1001
92+
- -QF1006
93+
- -QF1008
94+
testifylint:
95+
disable:
96+
- go-require
97+
- require-error
98+
usetesting:
99+
os-temp-dir: true
100+
exclusions:
101+
generated: lax
102+
presets:
103+
- comments
104+
- common-false-positives
105+
- legacy
106+
- std-error-handling
88107
rules:
89-
main:
90-
deny:
91-
- pkg: encoding/json
92-
desc: use gitea's modules/json instead of encoding/json
93-
- pkg: github.com/unknwon/com
94-
desc: use gitea's util and replacements
95-
- pkg: io/ioutil
96-
desc: use os or io instead
97-
- pkg: golang.org/x/exp
98-
desc: it's experimental and unreliable
99-
- pkg: code.gitea.io/gitea/modules/git/internal
100-
desc: do not use the internal package, use AddXxx function instead
101-
- pkg: gopkg.in/ini.v1
102-
desc: do not use the ini package, use gitea's config system instead
103-
- pkg: gitea.com/go-chi/cache
104-
desc: do not use the go-chi cache package, use gitea's cache system
105-
usetesting:
106-
os-temp-dir: true
107-
108+
- linters:
109+
- dupl
110+
- errcheck
111+
- gocyclo
112+
- gosec
113+
- staticcheck
114+
- unparam
115+
path: _test\.go
116+
- linters:
117+
- dupl
118+
- errcheck
119+
- gocyclo
120+
- gosec
121+
path: models/migrations/v
122+
- linters:
123+
- forbidigo
124+
path: cmd
125+
- linters:
126+
- dupl
127+
text: (?i)webhook
128+
- linters:
129+
- gocritic
130+
text: (?i)`ID' should not be capitalized
131+
- linters:
132+
- deadcode
133+
- unused
134+
text: (?i)swagger
135+
- linters:
136+
- staticcheck
137+
text: (?i)argument x is overwritten before first use
138+
- linters:
139+
- gocritic
140+
text: '(?i)commentFormatting: put a space between `//` and comment text'
141+
- linters:
142+
- gocritic
143+
text: '(?i)exitAfterDefer:'
144+
paths:
145+
- node_modules
146+
- public
147+
- web_src
148+
- third_party$
149+
- builtin$
150+
- examples$
108151
issues:
109152
max-issues-per-linter: 0
110153
max-same-issues: 0
111-
exclude-dirs: [node_modules, public, web_src]
112-
exclude-case-sensitive: true
113-
exclude-rules:
114-
- path: _test\.go
115-
linters:
116-
- gocyclo
117-
- errcheck
118-
- dupl
119-
- gosec
120-
- unparam
121-
- staticcheck
122-
- path: models/migrations/v
123-
linters:
124-
- gocyclo
125-
- errcheck
126-
- dupl
127-
- gosec
128-
- path: cmd
129-
linters:
130-
- forbidigo
131-
- text: "webhook"
132-
linters:
133-
- dupl
134-
- text: "`ID' should not be capitalized"
135-
linters:
136-
- gocritic
137-
- text: "swagger"
138-
linters:
139-
- unused
140-
- deadcode
141-
- text: "argument x is overwritten before first use"
142-
linters:
143-
- staticcheck
144-
- text: "commentFormatting: put a space between `//` and comment text"
145-
linters:
146-
- gocritic
147-
- text: "exitAfterDefer:"
148-
linters:
149-
- gocritic
154+
formatters:
155+
enable:
156+
- gofmt
157+
- gofumpt
158+
settings:
159+
gofumpt:
160+
extra-rules: true
161+
exclusions:
162+
generated: lax
163+
paths:
164+
- node_modules
165+
- public
166+
- web_src
167+
- third_party$
168+
- builtin$
169+
- examples$
170+
171+
run:
172+
timeout: 10m

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ XGO_VERSION := go-1.24.x
2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/[email protected]
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.7
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]

cmd/admin_auth_ldap_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ func TestAddLdapBindDn(t *testing.T) {
229229
return nil
230230
},
231231
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
232-
assert.FailNow(t, "case %d: should not call updateAuthSource", n)
232+
assert.FailNow(t, "updateAuthSource called", "case %d: should not call updateAuthSource", n)
233233
return nil
234234
},
235235
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
236-
assert.FailNow(t, "case %d: should not call getAuthSourceByID", n)
236+
assert.FailNow(t, "getAuthSourceByID called", "case %d: should not call getAuthSourceByID", n)
237237
return nil, nil
238238
},
239239
}
@@ -460,11 +460,11 @@ func TestAddLdapSimpleAuth(t *testing.T) {
460460
return nil
461461
},
462462
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
463-
assert.FailNow(t, "case %d: should not call updateAuthSource", n)
463+
assert.FailNow(t, "updateAuthSource called", "case %d: should not call updateAuthSource", n)
464464
return nil
465465
},
466466
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
467-
assert.FailNow(t, "case %d: should not call getAuthSourceByID", n)
467+
assert.FailNow(t, "getAuthSourceById called", "case %d: should not call getAuthSourceByID", n)
468468
return nil, nil
469469
},
470470
}
@@ -925,7 +925,7 @@ func TestUpdateLdapBindDn(t *testing.T) {
925925
return nil
926926
},
927927
createAuthSource: func(ctx context.Context, authSource *auth.Source) error {
928-
assert.FailNow(t, "case %d: should not call createAuthSource", n)
928+
assert.FailNow(t, "createAuthSource called", "case %d: should not call createAuthSource", n)
929929
return nil
930930
},
931931
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
@@ -1315,7 +1315,7 @@ func TestUpdateLdapSimpleAuth(t *testing.T) {
13151315
return nil
13161316
},
13171317
createAuthSource: func(ctx context.Context, authSource *auth.Source) error {
1318-
assert.FailNow(t, "case %d: should not call createAuthSource", n)
1318+
assert.FailNow(t, "createAuthSource called", "case %d: should not call createAuthSource", n)
13191319
return nil
13201320
},
13211321
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {

0 commit comments

Comments
 (0)