mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix various documentation, user-facing, and source comment typos (#16367)
* Fix various doc, user-facing, and source comment typos Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby`
This commit is contained in:
@@ -38,7 +38,7 @@ var IssueTemplateDirCandidates = []string{
|
||||
".gitlab/issue_template",
|
||||
}
|
||||
|
||||
// PullRequest contains informations to make a pull request
|
||||
// PullRequest contains information to make a pull request
|
||||
type PullRequest struct {
|
||||
BaseRepo *models.Repository
|
||||
Allowed bool
|
||||
|
@@ -34,7 +34,7 @@ type BlameReader struct {
|
||||
|
||||
var shaLineRegex = regexp.MustCompile("^([a-z0-9]{40})")
|
||||
|
||||
// NextPart returns next part of blame (sequencial code lines with the same commit)
|
||||
// NextPart returns next part of blame (sequential code lines with the same commit)
|
||||
func (r *BlameReader) NextPart() (*BlamePart, error) {
|
||||
var blamePart *BlamePart
|
||||
|
||||
|
@@ -110,7 +110,7 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) (*list
|
||||
}
|
||||
}
|
||||
|
||||
// add commiters if present in search query
|
||||
// add committers if present in search query
|
||||
if len(opts.Committers) > 0 {
|
||||
for _, v := range opts.Committers {
|
||||
args = append(args, "--committer="+v)
|
||||
@@ -150,7 +150,7 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) (*list
|
||||
stdout = append(stdout, '\n')
|
||||
}
|
||||
|
||||
// if there are any keywords (ie not commiter:, author:, time:)
|
||||
// if there are any keywords (ie not committer:, author:, time:)
|
||||
// then let's iterate over them
|
||||
if len(opts.Keywords) > 0 {
|
||||
for _, v := range opts.Keywords {
|
||||
@@ -195,12 +195,12 @@ func (repo *Repository) FileChangedBetweenCommits(filename, id1, id2 string) (bo
|
||||
return len(strings.TrimSpace(string(stdout))) > 0, nil
|
||||
}
|
||||
|
||||
// FileCommitsCount return the number of files at a revison
|
||||
// FileCommitsCount return the number of files at a revision
|
||||
func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) {
|
||||
return CommitsCountFiles(repo.Path, []string{revision}, []string{file})
|
||||
}
|
||||
|
||||
// CommitsByFileAndRange return the commits according revison file and the page
|
||||
// CommitsByFileAndRange return the commits according revision file and the page
|
||||
func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) {
|
||||
skip := (page - 1) * setting.Git.CommitsRangeSize
|
||||
|
||||
@@ -240,7 +240,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
|
||||
return repo.parsePrettyFormatLogToList(stdout)
|
||||
}
|
||||
|
||||
// CommitsByFileAndRangeNoFollow return the commits according revison file and the page
|
||||
// CommitsByFileAndRangeNoFollow return the commits according revision file and the page
|
||||
func (repo *Repository) CommitsByFileAndRangeNoFollow(revision, file string, page int) (*list.List, error) {
|
||||
stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*50),
|
||||
"--max-count="+strconv.Itoa(setting.Git.CommitsRangeSize), prettyLogFormat, "--", file).RunInDirBytes(repo.Path)
|
||||
|
@@ -33,7 +33,7 @@ type CodeActivityAuthor struct {
|
||||
Commits int64
|
||||
}
|
||||
|
||||
// GetCodeActivityStats returns code statistics for acitivity page
|
||||
// GetCodeActivityStats returns code statistics for activity page
|
||||
func (repo *Repository) GetCodeActivityStats(fromTime time.Time, branch string) (*CodeActivityStats, error) {
|
||||
stats := &CodeActivityStats{}
|
||||
|
||||
|
@@ -13,7 +13,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// ObjectCache provides thread-safe cache opeations.
|
||||
// ObjectCache provides thread-safe cache operations.
|
||||
type ObjectCache struct {
|
||||
lock sync.RWMutex
|
||||
cache map[string]interface{}
|
||||
|
@@ -284,7 +284,7 @@ func (b *ElasticSearchIndexer) Delete(repoID int64) error {
|
||||
}
|
||||
|
||||
// indexPos find words positions for start and the following end on content. It will
|
||||
// return the beginning position of the frist start and the ending position of the
|
||||
// return the beginning position of the first start and the ending position of the
|
||||
// first end following the start string.
|
||||
// If not found any of the positions, it will return -1, -1.
|
||||
func indexPos(content, start, end string) (int, int) {
|
||||
@@ -308,8 +308,8 @@ func convertResult(searchResult *elastic.SearchResult, kw string, pageSize int)
|
||||
var startIndex, endIndex int = -1, -1
|
||||
c, ok := hit.Highlight["content"]
|
||||
if ok && len(c) > 0 {
|
||||
// FIXME: Since the high lighting content will include <em> and </em> for the keywords,
|
||||
// now we should find the poisitions. But how to avoid html content which contains the
|
||||
// FIXME: Since the highlighting content will include <em> and </em> for the keywords,
|
||||
// now we should find the positions. But how to avoid html content which contains the
|
||||
// <em> and </em> tags? If elastic search has handled that?
|
||||
startIndex, endIndex = indexPos(c[0], "<em>", "</em>")
|
||||
if startIndex == -1 {
|
||||
|
@@ -49,7 +49,7 @@ type ObjectResponse struct {
|
||||
Error *ObjectError `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// Link provides a structure with informations about how to access a object.
|
||||
// Link provides a structure with information about how to access a object.
|
||||
type Link struct {
|
||||
Href string `json:"href"`
|
||||
Header map[string]string `json:"header,omitempty"`
|
||||
|
@@ -19,7 +19,7 @@ var statusToColor = map[int][]byte{
|
||||
500: ColorBytes(Bold, BgRed),
|
||||
}
|
||||
|
||||
// ColoredStatus addes colors for HTTP status
|
||||
// ColoredStatus adds colors for HTTP status
|
||||
func ColoredStatus(status int, s ...string) *ColoredValue {
|
||||
color, ok := statusToColor[status]
|
||||
if !ok {
|
||||
@@ -43,7 +43,7 @@ var methodToColor = map[string][]byte{
|
||||
"HEAD": ColorBytes(FgBlue, Faint),
|
||||
}
|
||||
|
||||
// ColoredMethod addes colors for HtTP methos on log
|
||||
// ColoredMethod adds colors for HTTP methods on log
|
||||
func ColoredMethod(method string) *ColoredValue {
|
||||
color, ok := methodToColor[method]
|
||||
if !ok {
|
||||
@@ -72,7 +72,7 @@ var (
|
||||
wayTooLong = ColorBytes(BgMagenta)
|
||||
)
|
||||
|
||||
// ColoredTime addes colors for time on log
|
||||
// ColoredTime adds colors for time on log
|
||||
func ColoredTime(duration time.Duration) *ColoredValue {
|
||||
for i, k := range durations {
|
||||
if duration < k {
|
||||
|
@@ -274,7 +274,7 @@ func RenderDescriptionHTML(
|
||||
}
|
||||
|
||||
// RenderEmoji for when we want to just process emoji and shortcodes
|
||||
// in various places it isn't already run through the normal markdown procesor
|
||||
// in various places it isn't already run through the normal markdown processor
|
||||
func RenderEmoji(
|
||||
content string,
|
||||
) (string, error) {
|
||||
|
@@ -74,7 +74,7 @@ func IsSummary(node ast.Node) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// TaskCheckBoxListItem is a block that repressents a list item of a markdown block with a checkbox
|
||||
// TaskCheckBoxListItem is a block that represents a list item of a markdown block with a checkbox
|
||||
type TaskCheckBoxListItem struct {
|
||||
*ast.ListItem
|
||||
IsChecked bool
|
||||
|
@@ -25,7 +25,7 @@ func TestMarkdownStripper(t *testing.T) {
|
||||
|
||||
This is [one](link) to paradise.
|
||||
This **is emphasized**.
|
||||
This: should coallesce.
|
||||
This: should coalesce.
|
||||
|
||||
` + "```" + `
|
||||
This is a code block.
|
||||
@@ -44,7 +44,7 @@ A HIDDEN ` + "`" + `GHOST` + "`" + ` IN THIS LINE.
|
||||
"This",
|
||||
"is emphasized",
|
||||
".",
|
||||
"This: should coallesce.",
|
||||
"This: should coalesce.",
|
||||
"Bullet 1",
|
||||
"Bullet 2",
|
||||
"A HIDDEN",
|
||||
|
@@ -18,7 +18,7 @@ type GetCommentOptions struct {
|
||||
PageSize int
|
||||
}
|
||||
|
||||
// Downloader downloads the site repo informations
|
||||
// Downloader downloads the site repo information
|
||||
type Downloader interface {
|
||||
SetContext(context.Context)
|
||||
GetRepoInfo() (*Repository, error)
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
package base
|
||||
|
||||
// Label defines a standard label informations
|
||||
// Label defines a standard label information
|
||||
type Label struct {
|
||||
Name string
|
||||
Color string
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
package base
|
||||
|
||||
// Uploader uploads all the informations of one repository
|
||||
// Uploader uploads all the information of one repository
|
||||
type Uploader interface {
|
||||
MaxBatchInsertSize(tp string) int
|
||||
CreateRepo(repo *Repository, opts MigrateOptions) error
|
||||
|
@@ -61,7 +61,7 @@ func (f *GithubDownloaderV3Factory) GitServiceType() structs.GitServiceType {
|
||||
return structs.GithubService
|
||||
}
|
||||
|
||||
// GithubDownloaderV3 implements a Downloader interface to get repository informations
|
||||
// GithubDownloaderV3 implements a Downloader interface to get repository information
|
||||
// from github via APIv3
|
||||
type GithubDownloaderV3 struct {
|
||||
base.NullDownloader
|
||||
|
@@ -56,7 +56,7 @@ func (f *GitlabDownloaderFactory) GitServiceType() structs.GitServiceType {
|
||||
return structs.GitlabService
|
||||
}
|
||||
|
||||
// GitlabDownloader implements a Downloader interface to get repository informations
|
||||
// GitlabDownloader implements a Downloader interface to get repository information
|
||||
// from gitlab via go-gitlab
|
||||
// - issueCount is incremented in GetIssues() to ensure PR and Issue numbers do not overlap,
|
||||
// because Gitlab has individual Issue and Pull Request numbers.
|
||||
|
@@ -57,7 +57,7 @@ func (f *GogsDownloaderFactory) GitServiceType() structs.GitServiceType {
|
||||
return structs.GogsService
|
||||
}
|
||||
|
||||
// GogsDownloader implements a Downloader interface to get repository informations
|
||||
// GogsDownloader implements a Downloader interface to get repository information
|
||||
// from gogs via API
|
||||
type GogsDownloader struct {
|
||||
base.NullDownloader
|
||||
|
@@ -143,7 +143,7 @@ func (*NullNotifier) NotifyPushCommits(pusher *models.User, repo *models.Reposit
|
||||
func (*NullNotifier) NotifyCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
|
||||
}
|
||||
|
||||
// NotifyDeleteRef notifies branch or tag deleteion to notifiers
|
||||
// NotifyDeleteRef notifies branch or tag deletion to notifiers
|
||||
func (*NullNotifier) NotifyDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
|
||||
}
|
||||
|
||||
|
@@ -481,7 +481,7 @@ func TestParseCloseKeywords(t *testing.T) {
|
||||
{",$!", "", ""},
|
||||
{"1234", "", ""},
|
||||
} {
|
||||
// The patern only needs to match the part that precedes the reference.
|
||||
// The pattern only needs to match the part that precedes the reference.
|
||||
// getCrossReference() takes care of finding the reference itself.
|
||||
pat := makeKeywordsPat([]string{test.pattern})
|
||||
if test.expected == "" {
|
||||
|
@@ -250,7 +250,7 @@ func TestUpdateIssuesCommit_AnotherRepoNoPermission(t *testing.T) {
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 10}).(*models.User)
|
||||
|
||||
// Test that a push with close reference *can not* close issue
|
||||
// If the commiter doesn't have push rights in that repo
|
||||
// If the committer doesn't have push rights in that repo
|
||||
pushCommits := []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "abcdef3",
|
||||
|
@@ -69,7 +69,7 @@ func TestGetContents(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("Get REAMDE.md contents with ref as empty string (should then use the repo's default branch) with GetContents()", func(t *testing.T) {
|
||||
t.Run("Get README.md contents with ref as empty string (should then use the repo's default branch) with GetContents()", func(t *testing.T) {
|
||||
fileContentResponse, err := GetContents(ctx.Repo.Repository, treePath, "", false)
|
||||
assert.EqualValues(t, expectedContentsResponse, fileContentResponse)
|
||||
assert.NoError(t, err)
|
||||
@@ -132,7 +132,7 @@ func TestGetContentsOrListForFile(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("Get REAMDE.md contents with ref as empty string (should then use the repo's default branch) with GetContentsOrList()", func(t *testing.T) {
|
||||
t.Run("Get README.md contents with ref as empty string (should then use the repo's default branch) with GetContentsOrList()", func(t *testing.T) {
|
||||
fileContentResponse, err := GetContentsOrList(ctx.Repo.Repository, treePath, "")
|
||||
assert.EqualValues(t, expectedContentsResponse, fileContentResponse)
|
||||
assert.NoError(t, err)
|
||||
|
@@ -129,12 +129,12 @@ func ListUnadoptedRepositories(query string, opts *models.ListOptions) ([]string
|
||||
var err error
|
||||
globUser, err = glob.Compile(qsplit[0])
|
||||
if err != nil {
|
||||
log.Info("Invalid glob expresion '%s' (skipped): %v", qsplit[0], err)
|
||||
log.Info("Invalid glob expression '%s' (skipped): %v", qsplit[0], err)
|
||||
}
|
||||
if len(qsplit) > 1 {
|
||||
globRepo, err = glob.Compile(qsplit[1])
|
||||
if err != nil {
|
||||
log.Info("Invalid glob expresion '%s' (skipped): %v", qsplit[1], err)
|
||||
log.Info("Invalid glob expression '%s' (skipped): %v", qsplit[1], err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
// New creats a new secret
|
||||
// New creates a new secret
|
||||
func New() (string, error) {
|
||||
return NewWithLength(44)
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ func IndexerGlobFromString(globstr string) []glob.Glob {
|
||||
expr = strings.TrimSpace(expr)
|
||||
if expr != "" {
|
||||
if g, err := glob.Compile(expr, '.', '/'); err != nil {
|
||||
log.Info("Invalid glob expresion '%s' (skipped): %v", expr, err)
|
||||
log.Info("Invalid glob expression '%s' (skipped): %v", expr, err)
|
||||
} else {
|
||||
extarr = append(extarr, g)
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// SessionConfig difines Session settings
|
||||
// SessionConfig defines Session settings
|
||||
SessionConfig = struct {
|
||||
Provider string
|
||||
// Provider configuration, it's corresponding to provider.
|
||||
|
@@ -71,7 +71,7 @@ type ObjectStorage interface {
|
||||
IterateObjects(func(path string, obj Object) error) error
|
||||
}
|
||||
|
||||
// Copy copys a file from source ObjectStorage to dest ObjectStorage
|
||||
// Copy copies a file from source ObjectStorage to dest ObjectStorage
|
||||
func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, srcPath string) (int64, error) {
|
||||
f, err := srcStorage.Open(srcPath)
|
||||
if err != nil {
|
||||
|
@@ -74,7 +74,7 @@ func runMigrateTask(t *models.Task) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// if repository is ready, then just finsih the task
|
||||
// if repository is ready, then just finish the task
|
||||
if t.Repo.Status == models.RepositoryReady {
|
||||
return nil
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ const SvgMimeType = "image/svg+xml"
|
||||
var svgTagRegex = regexp.MustCompile(`(?si)\A\s*(?:(<!--.*?-->|<!DOCTYPE\s+svg([\s:]+.*?>|>))\s*)*<svg[\s>\/]`)
|
||||
var svgTagInXMLRegex = regexp.MustCompile(`(?si)\A<\?xml\b.*?\?>\s*(?:(<!--.*?-->|<!DOCTYPE\s+svg([\s:]+.*?>|>))\s*)*<svg[\s>\/]`)
|
||||
|
||||
// SniffedType contains informations about a blobs type.
|
||||
// SniffedType contains information about a blobs type.
|
||||
type SniffedType struct {
|
||||
contentType string
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ func StatDir(rootPath string, includeDir ...bool) ([]string, error) {
|
||||
return statDir(rootPath, "", isIncludeDir, false, false)
|
||||
}
|
||||
|
||||
// FileURLToPath extracts the path informations from a file://... url.
|
||||
// FileURLToPath extracts the path information from a file://... url.
|
||||
func FileURLToPath(u *url.URL) (string, error) {
|
||||
if u.Scheme != "file" {
|
||||
return "", errors.New("URL scheme is not 'file': " + u.String())
|
||||
|
@@ -33,7 +33,7 @@ func TestShellEscape(t *testing.T) {
|
||||
"~git/Gitea v1.13/gitea",
|
||||
`~git/"Gitea v1.13/gitea"`,
|
||||
}, {
|
||||
"Bangs are unforutunately not predictable so need to be singlequoted",
|
||||
"Bangs are unfortunately not predictable so need to be singlequoted",
|
||||
"C:/Program Files/Gitea!/gitea",
|
||||
`'C:/Program Files/Gitea!/gitea'`,
|
||||
}, {
|
||||
@@ -41,7 +41,7 @@ func TestShellEscape(t *testing.T) {
|
||||
"/home/git/Gitea\n\nWHY-WOULD-YOU-DO-THIS\n\nGitea/gitea",
|
||||
"'/home/git/Gitea\n\nWHY-WOULD-YOU-DO-THIS\n\nGitea/gitea'",
|
||||
}, {
|
||||
"Similarly we should nicely handle mutiple single quotes if we have to single-quote",
|
||||
"Similarly we should nicely handle multiple single quotes if we have to single-quote",
|
||||
"'!''!'''!''!'!'",
|
||||
`\''!'\'\''!'\'\'\''!'\'\''!'\''!'\'`,
|
||||
}, {
|
||||
|
@@ -92,7 +92,7 @@ func IsValidExternalURL(uri string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: Later it should be added to allow local network IP addreses
|
||||
// TODO: Later it should be added to allow local network IP addresses
|
||||
// only if allowed by special setting
|
||||
|
||||
return true
|
||||
|
@@ -24,12 +24,12 @@ func Test_IsValidURL(t *testing.T) {
|
||||
valid: false,
|
||||
},
|
||||
{
|
||||
description: "Loobpack IPv4 URL",
|
||||
description: "Loopback IPv4 URL",
|
||||
url: "http://127.0.1.1:5678/",
|
||||
valid: true,
|
||||
},
|
||||
{
|
||||
description: "Loobpack IPv6 URL",
|
||||
description: "Loopback IPv6 URL",
|
||||
url: "https://[::1]/",
|
||||
valid: true,
|
||||
},
|
||||
@@ -61,7 +61,7 @@ func Test_IsValidExternalURL(t *testing.T) {
|
||||
valid: true,
|
||||
},
|
||||
{
|
||||
description: "Loobpack IPv4 URL",
|
||||
description: "Loopback IPv4 URL",
|
||||
url: "http://127.0.1.1:5678/",
|
||||
valid: false,
|
||||
},
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
var gitRefNameValidationTestCases = []validationTestCase{
|
||||
{
|
||||
description: "Referece contains only characters",
|
||||
description: "Reference name contains only characters",
|
||||
data: TestForm{
|
||||
BranchName: "test",
|
||||
},
|
||||
|
Reference in New Issue
Block a user