mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 22:13:26 +09:00
chore(typo): fix grammar in comments, API docs and error messages (#38370)
This commit is contained in:
@@ -10,10 +10,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sha1Pattern can be used to determine if a string is an valid sha
|
// sha1Pattern can be used to determine if a string is a valid sha
|
||||||
var sha1Pattern = regexp.MustCompile(`^[0-9a-f]{4,40}$`)
|
var sha1Pattern = regexp.MustCompile(`^[0-9a-f]{4,40}$`)
|
||||||
|
|
||||||
// sha256Pattern can be used to determine if a string is an valid sha
|
// sha256Pattern can be used to determine if a string is a valid sha
|
||||||
var sha256Pattern = regexp.MustCompile(`^[0-9a-f]{4,64}$`)
|
var sha256Pattern = regexp.MustCompile(`^[0-9a-f]{4,64}$`)
|
||||||
|
|
||||||
type ObjectFormat interface {
|
type ObjectFormat interface {
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ func validateOptions(field *api.IssueFormField, idx int) error {
|
|||||||
|
|
||||||
options, ok := field.Attributes["options"].([]any)
|
options, ok := field.Attributes["options"].([]any)
|
||||||
if !ok || len(options) == 0 {
|
if !ok || len(options) == 0 {
|
||||||
return position.Errorf("'options' is required and should be a array")
|
return position.Errorf("'options' is required and should be an array")
|
||||||
}
|
}
|
||||||
|
|
||||||
for optIdx, option := range options {
|
for optIdx, option := range options {
|
||||||
@@ -270,7 +270,7 @@ func validateDropdownDefault(position errorPosition, attributes map[string]any)
|
|||||||
options, ok := attributes["options"].([]any)
|
options, ok := attributes["options"].([]any)
|
||||||
if !ok {
|
if !ok {
|
||||||
// should not happen
|
// should not happen
|
||||||
return position.Errorf("'options' is required and should be a array")
|
return position.Errorf("'options' is required and should be an array")
|
||||||
}
|
}
|
||||||
if defaultValue < 0 || defaultValue >= len(options) {
|
if defaultValue < 0 || defaultValue >= len(options) {
|
||||||
return position.Errorf("the value of 'default' is out of range")
|
return position.Errorf("the value of 'default' is out of range")
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: "a"
|
label: "a"
|
||||||
`,
|
`,
|
||||||
wantErr: "body[0](dropdown): 'options' is required and should be a array",
|
wantErr: "body[0](dropdown): 'options' is required and should be an array",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "dropdown invalid options",
|
name: "dropdown invalid options",
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ var globalVars = sync.OnceValue(func() *globalVarsType {
|
|||||||
v := &globalVarsType{}
|
v := &globalVarsType{}
|
||||||
// NOTE: All below regex matching do not perform any extra validation.
|
// NOTE: All below regex matching do not perform any extra validation.
|
||||||
// Thus a link is produced even if the linked entity does not exist.
|
// Thus a link is produced even if the linked entity does not exist.
|
||||||
// While fast, this is also incorrect and lead to false positives.
|
// While fast, this is also incorrect and leads to false positives.
|
||||||
// TODO: fix invalid linking issue (update: stale TODO, what issues? maybe no TODO anymore)
|
// TODO: fix invalid linking issue (update: stale TODO, what issues? maybe no TODO anymore)
|
||||||
|
|
||||||
// valid chars in encoded path and parameter: [-+~_%.a-zA-Z0-9/]
|
// valid chars in encoded path and parameter: [-+~_%.a-zA-Z0-9/]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ var (
|
|||||||
|
|
||||||
// NOTE: All below regex matching do not perform any extra validation.
|
// NOTE: All below regex matching do not perform any extra validation.
|
||||||
// Thus a link is produced even if the linked entity does not exist.
|
// Thus a link is produced even if the linked entity does not exist.
|
||||||
// While fast, this is also incorrect and lead to false positives.
|
// While fast, this is also incorrect and leads to false positives.
|
||||||
// TODO: fix invalid linking issue
|
// TODO: fix invalid linking issue
|
||||||
|
|
||||||
// mentionPattern matches all mentions in the form of "@user" or "@org/team"
|
// mentionPattern matches all mentions in the form of "@user" or "@org/team"
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const (
|
|||||||
type NotifySubjectType string
|
type NotifySubjectType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// NotifySubjectIssue a issue is subject of an notification
|
// NotifySubjectIssue an issue is subject of a notification
|
||||||
NotifySubjectIssue NotifySubjectType = "Issue"
|
NotifySubjectIssue NotifySubjectType = "Issue"
|
||||||
// NotifySubjectPull a pull is subject of an notification
|
// NotifySubjectPull a pull is subject of an notification
|
||||||
NotifySubjectPull NotifySubjectType = "Pull"
|
NotifySubjectPull NotifySubjectType = "Pull"
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ import (
|
|||||||
"gitea.com/gitea/runner/act/model"
|
"gitea.com/gitea/runner/act/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListActionsSecrets list an repo's actions secrets
|
// ListActionsSecrets list a repo's actions secrets
|
||||||
func (Action) ListActionsSecrets(ctx *context.APIContext) {
|
func (Action) ListActionsSecrets(ctx *context.APIContext) {
|
||||||
// swagger:operation GET /repos/{owner}/{repo}/actions/secrets repository repoListActionsSecrets
|
// swagger:operation GET /repos/{owner}/{repo}/actions/secrets repository repoListActionsSecrets
|
||||||
// ---
|
// ---
|
||||||
// summary: List an repo's actions secrets
|
// summary: List a repo's actions secrets
|
||||||
// produces:
|
// produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// parameters:
|
// parameters:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
repo_service "gitea.dev/services/repository"
|
repo_service "gitea.dev/services/repository"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UpdateVatar updates the Avatar of an Repo
|
// UpdateAvatar updates the Avatar of a Repo
|
||||||
func UpdateAvatar(ctx *context.APIContext) {
|
func UpdateAvatar(ctx *context.APIContext) {
|
||||||
// swagger:operation POST /repos/{owner}/{repo}/avatar repository repoUpdateAvatar
|
// swagger:operation POST /repos/{owner}/{repo}/avatar repository repoUpdateAvatar
|
||||||
// ---
|
// ---
|
||||||
@@ -56,7 +56,7 @@ func UpdateAvatar(ctx *context.APIContext) {
|
|||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateAvatar deletes the Avatar of an Repo
|
// DeleteAvatar deletes the Avatar of a Repo
|
||||||
func DeleteAvatar(ctx *context.APIContext) {
|
func DeleteAvatar(ctx *context.APIContext) {
|
||||||
// swagger:operation DELETE /repos/{owner}/{repo}/avatar repository repoDeleteAvatar
|
// swagger:operation DELETE /repos/{owner}/{repo}/avatar repository repoDeleteAvatar
|
||||||
// ---
|
// ---
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"gitea.dev/services/context"
|
"gitea.dev/services/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetGitAllRefs get ref or an list all the refs of a repository
|
// GetGitAllRefs get ref or a list of all the refs of a repository
|
||||||
func GetGitAllRefs(ctx *context.APIContext) {
|
func GetGitAllRefs(ctx *context.APIContext) {
|
||||||
// swagger:operation GET /repos/{owner}/{repo}/git/refs repository repoListAllGitRefs
|
// swagger:operation GET /repos/{owner}/{repo}/git/refs repository repoListAllGitRefs
|
||||||
// ---
|
// ---
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ type RepositoryDumper struct {
|
|||||||
prHeadCache map[string]string
|
prHeadCache map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRepositoryDumper creates an gitea Uploader
|
// NewRepositoryDumper creates a gitea Uploader
|
||||||
func NewRepositoryDumper(ctx context.Context, baseDir, repoOwner, repoName string, opts base.MigrateOptions) (*RepositoryDumper, error) {
|
func NewRepositoryDumper(ctx context.Context, baseDir, repoOwner, repoName string, opts base.MigrateOptions) (*RepositoryDumper, error) {
|
||||||
baseDir = filepath.Join(baseDir, repoOwner, repoName)
|
baseDir = filepath.Join(baseDir, repoOwner, repoName)
|
||||||
if err := os.MkdirAll(baseDir, os.ModePerm); err != nil {
|
if err := os.MkdirAll(baseDir, os.ModePerm); err != nil {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ type GiteaLocalUploader struct {
|
|||||||
gitServiceType structs.GitServiceType
|
gitServiceType structs.GitServiceType
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGiteaLocalUploader creates an gitea Uploader via gitea API v1
|
// NewGiteaLocalUploader creates a gitea Uploader via gitea API v1
|
||||||
func NewGiteaLocalUploader(_ context.Context, doer *user_model.User, repoOwner, repoName string) *GiteaLocalUploader {
|
func NewGiteaLocalUploader(_ context.Context, doer *user_model.User, repoOwner, repoName string) *GiteaLocalUploader {
|
||||||
return &GiteaLocalUploader{
|
return &GiteaLocalUploader{
|
||||||
doer: doer,
|
doer: doer,
|
||||||
|
|||||||
Generated
+2
-2
@@ -5889,7 +5889,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"repository"
|
"repository"
|
||||||
],
|
],
|
||||||
"summary": "List an repo's actions secrets",
|
"summary": "List a repo's actions secrets",
|
||||||
"operationId": "repoListActionsSecrets",
|
"operationId": "repoListActionsSecrets",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -28066,7 +28066,7 @@
|
|||||||
"Commit",
|
"Commit",
|
||||||
"Repository"
|
"Repository"
|
||||||
],
|
],
|
||||||
"x-go-enum-desc": "Issue NotifySubjectIssue a issue is subject of an notification\nPull NotifySubjectPull a pull is subject of an notification\nCommit NotifySubjectCommit a commit is subject of an notification\nRepository NotifySubjectRepository a repository is subject of an notification",
|
"x-go-enum-desc": "Issue NotifySubjectIssue an issue is subject of a notification\nPull NotifySubjectPull a pull is subject of an notification\nCommit NotifySubjectCommit a commit is subject of an notification\nRepository NotifySubjectRepository a repository is subject of an notification",
|
||||||
"x-go-name": "Type"
|
"x-go-name": "Type"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
|
|||||||
Generated
+2
-2
@@ -7782,7 +7782,7 @@
|
|||||||
"Repository"
|
"Repository"
|
||||||
],
|
],
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-enum-desc": "Issue NotifySubjectIssue a issue is subject of an notification\nPull NotifySubjectPull a pull is subject of an notification\nCommit NotifySubjectCommit a commit is subject of an notification\nRepository NotifySubjectRepository a repository is subject of an notification",
|
"x-go-enum-desc": "Issue NotifySubjectIssue an issue is subject of a notification\nPull NotifySubjectPull a pull is subject of an notification\nCommit NotifySubjectCommit a commit is subject of an notification\nRepository NotifySubjectRepository a repository is subject of an notification",
|
||||||
"x-go-name": "Type"
|
"x-go-name": "Type"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
@@ -16954,7 +16954,7 @@
|
|||||||
"$ref": "#/components/responses/notFound"
|
"$ref": "#/components/responses/notFound"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"summary": "List an repo's actions secrets",
|
"summary": "List a repo's actions secrets",
|
||||||
"tags": [
|
"tags": [
|
||||||
"repository"
|
"repository"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user