Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15cf513

Browse files
authored
Merge branch 'main' into labels-list-gap
2 parents 0f1ea9a + aa9d867 commit 15cf513

File tree

351 files changed

+454
-521
lines changed

Some content is hidden

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

351 files changed

+454
-521
lines changed

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ linters:
4545
desc: do not use the ini package, use gitea's config system instead
4646
- pkg: gitea.com/go-chi/cache
4747
desc: do not use the go-chi cache package, use gitea's cache system
48+
nolintlint:
49+
allow-unused: false
50+
require-explanation: true
51+
require-specific: true
4852
gocritic:
4953
disabled-checks:
5054
- ifElseChain
@@ -83,6 +87,10 @@ linters:
8387
- name: unreachable-code
8488
- name: var-declaration
8589
- name: var-naming
90+
arguments:
91+
- [] # AllowList - do not remove as args for the rule are positional and won't work without lists first
92+
- [] # DenyList
93+
- - skip-package-name-checks: true # supress errors from underscore in migration packages
8694
staticcheck:
8795
checks:
8896
- all

cmd/embedded.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,14 @@ func collectAssetFilesByPattern(c *cli.Command, globs []glob.Glob, path string,
295295
}
296296
}
297297

298-
func compileCollectPatterns(args []string) ([]glob.Glob, error) {
298+
func compileCollectPatterns(args []string) (_ []glob.Glob, err error) {
299299
if len(args) == 0 {
300300
args = []string{"**"}
301301
}
302302
pat := make([]glob.Glob, len(args))
303303
for i := range args {
304-
if g, err := glob.Compile(args[i], '/'); err != nil {
305-
return nil, fmt.Errorf("'%s': Invalid glob pattern: %w", args[i], err)
306-
} else { //nolint:revive
307-
pat[i] = g
304+
if pat[i], err = glob.Compile(args[i], '/'); err != nil {
305+
return nil, fmt.Errorf("invalid glob patterh %q: %w", args[i], err)
308306
}
309307
}
310308
return pat, nil

contrib/backport/backport.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2023 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
//nolint:forbidigo
4+
//nolint:forbidigo // use of print functions is allowed in cli
55
package main
66

77
import (

models/actions/task.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,13 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
278278
return nil, false, err
279279
}
280280

281-
var workflowJob *jobparser.Job
282-
if gots, err := jobparser.Parse(job.WorkflowPayload); err != nil {
281+
parsedWorkflows, err := jobparser.Parse(job.WorkflowPayload)
282+
if err != nil {
283283
return nil, false, fmt.Errorf("parse workflow of job %d: %w", job.ID, err)
284-
} else if len(gots) != 1 {
284+
} else if len(parsedWorkflows) != 1 {
285285
return nil, false, fmt.Errorf("workflow of job %d: not single workflow", job.ID)
286-
} else { //nolint:revive
287-
_, workflowJob = gots[0].Job()
288286
}
287+
_, workflowJob := parsedWorkflows[0].Job()
289288

290289
if _, err := e.Insert(task); err != nil {
291290
return nil, false, err

models/asymkey/ssh_key_parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func SSHNativeParsePublicKey(keyLine string) (string, int, error) {
208208

209209
// The ssh library can parse the key, so next we find out what key exactly we have.
210210
switch pkey.Type() {
211-
case ssh.KeyAlgoDSA: //nolint
211+
case ssh.KeyAlgoDSA: //nolint:staticcheck // it's deprecated
212212
rawPub := struct {
213213
Name string
214214
P, Q, G, Y *big.Int

models/auth/auth_token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
var ErrAuthTokenNotExist = util.NewNotExistErrorf("auth token does not exist")
1717

18-
type AuthToken struct { //nolint:revive
18+
type AuthToken struct { //nolint:revive // export stutter
1919
ID string `xorm:"pk"`
2020
TokenHash string
2121
UserID int64 `xorm:"INDEX"`

models/db/sql_postgres_with_schema.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
3939

4040
// golangci lint is incorrect here - there is no benefit to using driver.ExecerContext here
4141
// and in any case pq does not implement it
42-
if execer, ok := conn.(driver.Execer); ok { //nolint:staticcheck
42+
if execer, ok := conn.(driver.Execer); ok { //nolint:staticcheck // see above
4343
_, err := execer.Exec(`SELECT set_config(
4444
'search_path',
4545
$1 || ',' || current_setting('search_path'),
@@ -64,7 +64,7 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
6464
// driver.String.ConvertValue will never return err for string
6565

6666
// golangci lint is incorrect here - there is no benefit to using stmt.ExecWithContext here
67-
_, err = stmt.Exec([]driver.Value{schemaValue}) //nolint:staticcheck
67+
_, err = stmt.Exec([]driver.Value{schemaValue}) //nolint:staticcheck // see above
6868
if err != nil {
6969
_ = conn.Close()
7070
return nil, err

models/issues/issue_search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const ScopeSortPrefix = "scope-"
2525

2626
// IssuesOptions represents options of an issue.
27-
type IssuesOptions struct { //nolint
27+
type IssuesOptions struct { //nolint:revive // export stutter
2828
Paginator *db.ListOptions
2929
RepoIDs []int64 // overwrites RepoCond if the length is not 0
3030
AllPublic bool // include also all public repositories

models/migrations/base/tests.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2022 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
//nolint:forbidigo
54
package base
65

76
import (
@@ -106,7 +105,7 @@ func MainTest(m *testing.M) {
106105
giteaConf := os.Getenv("GITEA_CONF")
107106
if giteaConf == "" {
108107
giteaConf = filepath.Join(filepath.Dir(setting.AppPath), "tests/sqlite.ini")
109-
fmt.Printf("Environment variable $GITEA_CONF not set - defaulting to %s\n", giteaConf)
108+
_, _ = fmt.Fprintf(os.Stderr, "Environment variable $GITEA_CONF not set - defaulting to %s\n", giteaConf)
110109
}
111110

112111
if !filepath.IsAbs(giteaConf) {
@@ -134,7 +133,7 @@ func MainTest(m *testing.M) {
134133
exitStatus := m.Run()
135134

136135
if err := removeAllWithRetry(setting.RepoRootPath); err != nil {
137-
fmt.Fprintf(os.Stderr, "os.RemoveAll: %v\n", err)
136+
_, _ = fmt.Fprintf(os.Stderr, "os.RemoveAll: %v\n", err)
138137
}
139138
os.Exit(exitStatus)
140139
}

models/migrations/v1_10/v100.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2019 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
package v1_10 //nolint
4+
package v1_10
55

66
import (
77
"net/url"

0 commit comments

Comments
 (0)