Skip to content

Commit f0ed6f4

Browse files
authored
Merge branch 'go-gitea:main' into main
2 parents 0bbfaef + d6d643f commit f0ed6f4

File tree

591 files changed

+3645
-2900
lines changed

Some content is hidden

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

591 files changed

+3645
-2900
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ module.exports = {
9191
plugins: ['@vitest/eslint-plugin'],
9292
globals: vitestPlugin.environments.env.globals,
9393
rules: {
94+
'github/unescaped-html-literal': [0],
9495
'@vitest/consistent-test-filename': [0],
9596
'@vitest/consistent-test-it': [0],
9697
'@vitest/expect-expect': [0],
@@ -423,7 +424,7 @@ module.exports = {
423424
'github/no-useless-passive': [2],
424425
'github/prefer-observers': [2],
425426
'github/require-passive-events': [2],
426-
'github/unescaped-html-literal': [0],
427+
'github/unescaped-html-literal': [2],
427428
'grouped-accessor-pairs': [2],
428429
'guard-for-in': [0],
429430
'id-blacklist': [0],

.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

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ COMMA := ,
2626
XGO_VERSION := go-1.24.x
2727

2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
29-
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.2.1
30-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.7.0
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
29+
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
30+
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
33-
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0
34-
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0
33+
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.7.0
34+
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.32.3
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
3737
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
3838
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1
39-
GOPLS_PACKAGE ?= golang.org/x/tools/[email protected].0
40-
GOPLS_MODERNIZE_PACKAGE ?= golang.org/x/tools/gopls/internal/analysis/modernize/cmd/[email protected].0
39+
GOPLS_PACKAGE ?= golang.org/x/tools/[email protected].1
40+
GOPLS_MODERNIZE_PACKAGE ?= golang.org/x/tools/gopls/internal/analysis/modernize/cmd/[email protected].1
4141

4242
DOCKER_IMAGE ?= gitea/gitea
4343
DOCKER_TAG ?= latest
@@ -81,7 +81,6 @@ ifeq ($(RACE_ENABLED),true)
8181
endif
8282

8383
STORED_VERSION_FILE := VERSION
84-
HUGO_VERSION ?= 0.111.3
8584

8685
GITHUB_REF_TYPE ?= branch
8786
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)

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/run_job.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status {
185185
return StatusSuccess
186186
case hasCancelled:
187187
return StatusCancelled
188-
case hasFailure:
189-
return StatusFailure
190188
case hasRunning:
191189
return StatusRunning
190+
case hasFailure:
191+
return StatusFailure
192192
case hasWaiting:
193193
return StatusWaiting
194194
case hasBlocked:

models/actions/run_job_status_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ func TestAggregateJobStatus(t *testing.T) {
5858
{[]Status{StatusCancelled, StatusRunning}, StatusCancelled},
5959
{[]Status{StatusCancelled, StatusBlocked}, StatusCancelled},
6060

61-
// failure with other status, fail fast
62-
// Should "running" win? Maybe no: old code does make "running" win, but GitHub does fail fast.
61+
// failure with other status, usually fail fast, but "running" wins to match GitHub's behavior
62+
// another reason that we can't make "failure" wins over "running": it would cause a weird behavior that user cannot cancel a workflow or get current running workflows correctly by filter after a job fail.
6363
{[]Status{StatusFailure}, StatusFailure},
6464
{[]Status{StatusFailure, StatusSuccess}, StatusFailure},
6565
{[]Status{StatusFailure, StatusSkipped}, StatusFailure},
6666
{[]Status{StatusFailure, StatusCancelled}, StatusCancelled},
6767
{[]Status{StatusFailure, StatusWaiting}, StatusFailure},
68-
{[]Status{StatusFailure, StatusRunning}, StatusFailure},
68+
{[]Status{StatusFailure, StatusRunning}, StatusRunning},
6969
{[]Status{StatusFailure, StatusBlocked}, StatusFailure},
7070

7171
// skipped with other status

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/gpg_key_add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func AddGPGKey(ctx context.Context, ownerID int64, content, token, signature str
9191
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil)
9292
}
9393
if err != nil {
94-
log.Error("Unable to validate token signature. Error: %v", err)
94+
log.Debug("AddGPGKey CheckArmoredDetachedSignature failed: %v", err)
9595
return nil, ErrGPGInvalidTokenSignature{
9696
ID: ekeys[0].PrimaryKey.KeyIdString(),
9797
Wrapped: err,

models/asymkey/gpg_key_verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func VerifyGPGKey(ctx context.Context, ownerID int64, keyID, token, signature st
8585
}
8686

8787
if signer == nil {
88-
log.Error("Unable to validate token signature. Error: %v", err)
88+
log.Debug("VerifyGPGKey failed: no signer")
8989
return "", ErrGPGInvalidTokenSignature{
9090
ID: key.KeyID,
9191
}

0 commit comments

Comments
 (0)