0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-11 04:55:34 +02:00

fix: lint errors

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2026-05-04 17:38:38 -04:00
parent c3f1730960
commit 6b5e17369f
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C
8 changed files with 18641 additions and 77 deletions

View File

@ -52,6 +52,8 @@ func (o OrderedMap) Iter() iter.Seq2[string, any] {
}
}
var errNilSentinel = errors.New("nil sentinel")
func (o *OrderedMap) UnmarshalJSON(data []byte) error {
trimmed := bytes.TrimSpace(data)
if bytes.Equal(trimmed, []byte("null")) {
@ -128,7 +130,7 @@ func (o *OrderedMap) UnmarshalJSON(data []byte) error {
func decodeJSONValue(raw encjson.RawMessage) (any, error) {
t := bytes.TrimSpace(raw)
if bytes.Equal(t, []byte("null")) {
return nil, nil
return nil, errNilSentinel
}
d := encjson.NewDecoder(bytes.NewReader(raw))
@ -156,7 +158,7 @@ func decodeJSONValue(raw encjson.RawMessage) (any, error) {
return nil, err
}
v, err := decodeJSONValue(elemRaw)
if err != nil {
if err != nil && !errors.Is(err, errNilSentinel) {
return nil, err
}
arr = append(arr, v)
@ -278,12 +280,12 @@ func generatePaths(root string) *OrderedMap {
}
func writeMapToFile(filename string, data *OrderedMap) {
bytes, err := json.MarshalIndent(data, "", " ")
marshaledBytes, err := json.MarshalIndent(data, "", " ")
if err != nil {
log.Fatal(err)
}
bytes = append(bytes, '\n')
err = os.WriteFile(filename, bytes, 0o666)
marshaledBytes = append(marshaledBytes, '\n')
err = os.WriteFile(filename, marshaledBytes, 0o666)
if err != nil {
log.Fatal(err)
}

View File

@ -26,7 +26,7 @@ func TestIterateLFSMetaObjectsForRepoUpdatesDoNotSkip(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
ctx := t.Context()
repo, err := repo_model.GetRepositoryByOwnerAndName(ctx, "user2", "repo1")
repo, err := repo_model.GetRepositoryByOwnerAndName(ctx, "user2", "repo1", 0)
assert.NoError(t, err)
defer test.MockVariableValue(&setting.Database.IterateBufferSize, 1)()

View File

@ -1,3 +1,6 @@
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package org
import (

View File

@ -4524,7 +4524,7 @@
}
},
"post": {
"description": "Uses automatic pagination based on default page size and max response size and returns the maximum allowed number of files. Files which could not be retrieved are null. Files which are too large are being returned with `encoding == null`, `content == null` and `size \u003e 0`, they can be requested separately by using the `download_url`.",
"description": "Uses automatic pagination based on default page size and max response size and returns the maximum allowed number of files. Files which could not be retrieved are null. Files which are too large are being returned with `encoding == null`, `content == null` and `size > 0`, they can be requested separately by using the `download_url`.",
"produces": [
"application/json"
],
@ -10689,7 +10689,7 @@
"type": "string"
},
"collectionFormat": "multi",
"description": "Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread \u0026 pinned",
"description": "Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned",
"name": "status-types",
"in": "query"
},

View File

@ -5553,6 +5553,12 @@
"in": "path",
"required": true
},
{
"type": "boolean",
"description": "filter by disabled status (true or false)",
"name": "disabled",
"in": "query"
},
{
"type": "integer",
"format": "int64",
@ -5564,7 +5570,7 @@
],
"responses": {
"200": {
"$ref": "#/definitions/ActionRunnersResponse"
"$ref": "#/responses/RunnerList"
},
"400": {
"$ref": "#/responses/error"
@ -5576,45 +5582,6 @@
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runners/registration-token": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Get a repository's actions runner registration token",
"operationId": "repoGetRunnerRegistrationTokenMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/RegistrationToken"
}
}
},
"post": {
"produces": [
"application/json"
@ -5663,7 +5630,7 @@
"tags": [
"repository"
],
"summary": "Get an repo-level runner",
"summary": "Get a repo-level runner",
"operationId": "getRepoRunnerMixin0",
"parameters": [
{
@ -5698,7 +5665,7 @@
],
"responses": {
"200": {
"$ref": "#/definitions/ActionRunner"
"$ref": "#/responses/Runner"
},
"400": {
"$ref": "#/responses/error"
@ -5715,7 +5682,7 @@
"tags": [
"repository"
],
"summary": "Delete an repo-level runner",
"summary": "Delete a repo-level runner",
"operationId": "deleteRepoRunnerMixin0",
"parameters": [
{
@ -5759,6 +5726,71 @@
"$ref": "#/responses/notFound"
}
}
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Update a repo-level runner",
"operationId": "updateRepoRunnerMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "id of the runner",
"name": "runner_id",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/EditActionRunnerOption"
}
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/Runner"
},
"400": {
"$ref": "#/responses/error"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runs": {
@ -5876,7 +5908,7 @@
"required": true
},
{
"type": "string",
"type": "integer",
"description": "id of the run",
"name": "run",
"in": "path",
@ -6016,6 +6048,146 @@
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runs/{run}/attempts/{attempt}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Gets a specific workflow run attempt",
"operationId": "getWorkflowRunAttemptMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the run",
"name": "run",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "logical attempt number of the run",
"name": "attempt",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/WorkflowRun"
},
"400": {
"$ref": "#/responses/error"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runs/{run}/attempts/{attempt}/jobs": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Lists all jobs for a workflow run attempt",
"operationId": "listWorkflowRunAttemptJobsMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the workflow run",
"name": "run",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "logical attempt number of the run",
"name": "attempt",
"in": "path",
"required": true
},
{
"type": "string",
"description": "workflow status (pending, queued, in_progress, failure, success, skipped)",
"name": "status",
"in": "query"
},
{
"type": "integer",
"description": "page number of results to return (1-based)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "page size of results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/WorkflowJobsList"
},
"400": {
"$ref": "#/responses/error"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runs/{run}/jobs": {
"get": {
"produces": [
@ -6088,6 +6260,199 @@
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runs/{run}/jobs/{job_id}/rerun": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Reruns a specific workflow job in a run",
"operationId": "rerunWorkflowJobMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the run",
"name": "run",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the job",
"name": "job_id",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/WorkflowJob"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"409": {
"$ref": "#/responses/error"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runs/{run}/rerun": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Reruns an entire workflow run",
"operationId": "rerunWorkflowRunMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the run",
"name": "run",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/WorkflowRun"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"409": {
"$ref": "#/responses/error"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/runs/{run}/rerun-failed-jobs": {
"post": {
"tags": [
"repository"
],
"summary": "Reruns all failed jobs in a workflow run",
"operationId": "rerunFailedWorkflowRunMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the run",
"name": "run",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/empty"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"409": {
"$ref": "#/responses/error"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/actions/secrets": {
"get": {
"produces": [
@ -6847,6 +7212,12 @@
"$ref": "#/definitions/CreateActionWorkflowDispatch"
}
},
{
"type": "boolean",
"description": "Whether the response should include the workflow run ID and URLs.",
"name": "return_run_details",
"in": "query"
},
{
"type": "integer",
"format": "int64",
@ -6857,8 +7228,11 @@
}
],
"responses": {
"200": {
"$ref": "#/responses/RunDetails"
},
"204": {
"description": "No Content"
"description": "No Content, if return_run_details is missing or false"
},
"400": {
"$ref": "#/responses/error"
@ -7033,6 +7407,16 @@
"in": "path",
"required": true
},
{
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi",
"description": "subpath of the repository to download",
"name": "path",
"in": "query"
},
{
"type": "integer",
"format": "int64",
@ -11384,7 +11768,7 @@
}
],
"responses": {
"200": {
"204": {
"$ref": "#/responses/empty"
},
"403": {
@ -11542,6 +11926,7 @@
}
},
"patch": {
"description": "Pass `content_version` to enable optimistic locking on body edits.\nIf the version doesn't match the current value, the request fails with 409 Conflict.\n",
"consumes": [
"application/json"
],
@ -13387,7 +13772,7 @@
}
],
"responses": {
"200": {
"204": {
"$ref": "#/responses/empty"
},
"403": {
@ -15617,6 +16002,122 @@
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/pulls/comments/{id}/resolve": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Resolve a pull request review comment",
"operationId": "repoResolvePullReviewCommentMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "id of the review comment",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"$ref": "#/responses/empty"
},
"400": {
"$ref": "#/responses/validationError"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/pulls/comments/{id}/unresolve": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Unresolve a pull request review comment",
"operationId": "repoUnresolvePullReviewCommentMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "id of the review comment",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"$ref": "#/responses/empty"
},
"400": {
"$ref": "#/responses/validationError"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/pulls/pinned": {
"get": {
"produces": [
@ -15912,6 +16413,83 @@
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/pulls/{index}/comments/{id}/replies": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Reply to a pull request review comment",
"operationId": "repoCreatePullReviewCommentReplyMixin0",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "index of the pull request",
"name": "index",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "id of the review comment to reply to",
"name": "id",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CreatePullReviewCommentReplyOptions"
}
},
{
"type": "integer",
"format": "int64",
"description": "group ID of the repo",
"name": "group_id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/PullReviewComment"
},
"400": {
"$ref": "#/responses/validationError"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/group/{group_id}/{repo}/pulls/{index}/commits": {
"get": {
"produces": [
@ -16173,6 +16751,9 @@
"200": {
"$ref": "#/responses/empty"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
@ -16441,7 +17022,7 @@
"tags": [
"repository"
],
"summary": "Create a review to an pull request",
"summary": "Create a review to a pull request",
"operationId": "repoCreatePullReviewMixin0",
"parameters": [
{
@ -16562,7 +17143,7 @@
"tags": [
"repository"
],
"summary": "Submit a pending review to an pull request",
"summary": "Submit a pending review to a pull request",
"operationId": "repoSubmitPullReviewMixin0",
"parameters": [
{
@ -17323,7 +17904,7 @@
},
{
"type": "boolean",
"description": "filter (exclude / include) drafts, if you dont have repo write access none will show",
"description": "filter (exclude / include) drafts, if you don't have repo write access none will show",
"name": "draft",
"in": "query"
},

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package integration
import (
@ -48,7 +51,7 @@ func TestNonOrgMemberWontSeeHiddenTopLevelGroups(t *testing.T) {
ParentGroupID: 0,
OwnerID: 43,
}.ToConds())
assert.NotEqual(t, len(groups), expectedLen)
assert.NotEqual(t, expectedLen, len(groups))
}
func TestGroupNotAccessibleWhenParentIsPrivate(t *testing.T) {

View File

@ -1,13 +0,0 @@
// Copyright 2025 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package integration
import "fmt"
func maybeGroupSegment(gid int64) string {
if gid > 0 {
return fmt.Sprintf("group/%d/", gid)
}
return ""
}