Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ func runSendMail(ctx context.Context, c *cli.Command) error {
setting.MustInstalled()

subject := c.String("title")
confirmSkiped := c.Bool("force")
confirmSkipped := c.Bool("force")
body := c.String("content")

if !confirmSkiped {
if !confirmSkipped {
if len(body) == 0 {
fmt.Print("warning: Content is empty")
}
Expand Down
4 changes: 2 additions & 2 deletions models/issues/review_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ func GetReviewsByIssueID(ctx context.Context, issueID int64) (latestReviews, mig
reviewersMap := make(map[int64][]*Review) // key is reviewer id
originalReviewersMap := make(map[int64][]*Review) // key is original author id
reviewTeamsMap := make(map[int64][]*Review) // key is reviewer team id
countedReivewTypes := []ReviewType{ReviewTypeApprove, ReviewTypeReject, ReviewTypeRequest, ReviewTypeComment}
countedReviewTypes := []ReviewType{ReviewTypeApprove, ReviewTypeReject, ReviewTypeRequest, ReviewTypeComment}
for _, review := range reviews {
if review.ReviewerTeamID == 0 && slices.Contains(countedReivewTypes, review.Type) && !review.Dismissed {
if review.ReviewerTeamID == 0 && slices.Contains(countedReviewTypes, review.Type) && !review.Dismissed {
if review.OriginalAuthorID != 0 {
originalReviewersMap[review.OriginalAuthorID] = append(originalReviewersMap[review.OriginalAuthorID], review)
} else {
Expand Down
2 changes: 1 addition & 1 deletion models/organization/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (org *Organization) HomeLink() string {
return org.AsUser().HomeLink()
}

// FindOrgMembersOpts represensts find org members conditions
// FindOrgMembersOpts represents find org members conditions
type FindOrgMembersOpts struct {
db.ListOptions
Doer *user_model.User
Expand Down
2 changes: 1 addition & 1 deletion models/user/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (users UserList) GetUserIDs() []int64 {
return userIDs
}

// GetTwoFaStatus return state of 2FA enrollement
// GetTwoFaStatus return state of 2FA enrollment
func (users UserList) GetTwoFaStatus(ctx context.Context) map[int64]bool {
results := make(map[int64]bool, len(users))
for _, user := range users {
Expand Down
2 changes: 1 addition & 1 deletion models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (u *User) BeforeUpdate() {
}

// FIXME: this email doesn't need to be in lowercase, because the emails are mainly managed by the email table with lower_email field
// This trick could be removed in new releases to display the user inputed email as-is.
// This trick could be removed in new releases to display the user inputted email as-is.
u.Email = strings.ToLower(u.Email)
if !u.IsOrganization() {
if len(u.AvatarEmail) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion modules/actions/workflows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func TestDetectMatched(t *testing.T) {
expected: true,
},
{
desc: "HookEventSchedue(schedule) matches GithubEventSchedule(schedule)",
desc: "HookEventSchedule(schedule) matches GithubEventSchedule(schedule)",
triggedEvent: webhook_module.HookEventSchedule,
payload: nil,
yamlOn: "on: schedule",
Expand Down
2 changes: 1 addition & 1 deletion modules/auth/password/hash/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DefaultHashAlgorithmName = "pbkdf2"

var DefaultHashAlgorithm *PasswordHashAlgorithm

// aliasAlgorithNames provides a mapping between the value of PASSWORD_HASH_ALGO
// aliasAlgorithmNames provides a mapping between the value of PASSWORD_HASH_ALGO
// configured in the app.ini and the parameters used within the hashers internally.
//
// If it is necessary to change the default parameters for any hasher in future you
Expand Down
2 changes: 1 addition & 1 deletion modules/git/foreachref/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (f Format) Parser(r io.Reader) *Parser {
return NewParser(r, f)
}

// hexEscaped produces hex-escpaed characters from a string. For example, "\n\0"
// hexEscaped produces hex-escaped characters from a string. For example, "\n\0"
// would turn into "%0a%00".
func (f Format) hexEscaped(delim []byte) string {
var escaped strings.Builder
Expand Down
4 changes: 2 additions & 2 deletions modules/indexer/code/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func (b *Indexer) Search(ctx context.Context, opts *internal.SearchOptions) (int
elastic.NewHighlight().
Field("content").
Field("filename").
NumOfFragments(0). // return all highting content on fragments
NumOfFragments(0). // return all highlighting content on fragments
HighlighterType("fvh"),
).
Sort("_score", false).
Expand Down Expand Up @@ -426,7 +426,7 @@ func (b *Indexer) Search(ctx context.Context, opts *internal.SearchOptions) (int
elastic.NewHighlight().
Field("content").
Field("filename").
NumOfFragments(0). // return all highting content on fragments
NumOfFragments(0). // return all highlighting content on fragments
HighlighterType("fvh"),
).
Sort("_score", false).
Expand Down
2 changes: 1 addition & 1 deletion modules/lfstransfer/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (g *GiteaBackend) Batch(_ string, pointers []transfer.BatchItem, args trans
var respBody lfs.BatchResponse
err = json.Unmarshal(respBytes, &respBody)
if err != nil {
g.logger.Log("json umarshal error", err)
g.logger.Log("json unmarshal error", err)
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions modules/lfstransfer/backend/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (g *giteaLockBackend) Create(path, refname string) (transfer.Lock, error) {
var respBody lfslock.LFSLockResponse
err = json.Unmarshal(respBytes, &respBody)
if err != nil {
g.logger.Log("json umarshal error", err)
g.logger.Log("json unmarshal error", err)
return nil, err
}

Expand Down Expand Up @@ -202,7 +202,7 @@ func (g *giteaLockBackend) queryLocks(v url.Values) ([]transfer.Lock, string, er
var respBody lfslock.LFSLockList
err = json.Unmarshal(respBytes, &respBody)
if err != nil {
g.logger.Log("json umarshal error", err)
g.logger.Log("json unmarshal error", err)
return nil, "", err
}

Expand Down
2 changes: 1 addition & 1 deletion modules/lfstransfer/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ func newLogger() transfer.Logger {
}

// Log implements transfer.Logger
func (g *GiteaLogger) Log(msg string, itms ...any) {
func (g *GiteaLogger) Log(msg string, items ...any) {
}
8 changes: 4 additions & 4 deletions modules/markup/common/linkify.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
)

type GlobalVarsType struct {
wwwURLRegxp *regexp.Regexp
LinkRegex *regexp.Regexp // fast matching a URL link, no any extra validation.
wwwURLRegexp *regexp.Regexp
LinkRegex *regexp.Regexp // fast matching a URL link, no any extra validation.
}

var GlobalVars = sync.OnceValue(func() *GlobalVarsType {
v := &GlobalVarsType{}
v.wwwURLRegxp = regexp.MustCompile(`^www\.[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}((?:/|[#?])[-a-zA-Z0-9@:%_\+.~#!?&//=\(\);,'">\^{}\[\]` + "`" + `]*)?`)
v.wwwURLRegexp = regexp.MustCompile(`^www\.[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}((?:/|[#?])[-a-zA-Z0-9@:%_\+.~#!?&//=\(\);,'">\^{}\[\]` + "`" + `]*)?`)
v.LinkRegex, _ = xurls.StrictMatchingScheme("https?://")
return v
})
Expand Down Expand Up @@ -75,7 +75,7 @@ func (s *linkifyParser) Parse(parent ast.Node, block text.Reader, pc parser.Cont
m = GlobalVars().LinkRegex.FindSubmatchIndex(line)
}
if m == nil && bytes.HasPrefix(line, domainWWW) {
m = GlobalVars().wwwURLRegxp.FindSubmatchIndex(line)
m = GlobalVars().wwwURLRegexp.FindSubmatchIndex(line)
protocol = []byte("http")
}
if m != nil {
Expand Down
2 changes: 1 addition & 1 deletion modules/setting/config/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (opt *Option[T]) WithDefaultSimple(def T) *Option[T] {
switch v.(type) {
case string, bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:
default:
// TODO: use reflect to support convertable basic types like `type State string`
// TODO: use reflect to support convertible basic types like `type State string`
r := reflect.ValueOf(v)
if r.Kind() != reflect.Struct {
panic("invalid type for default value, use WithDefaultFunc instead")
Expand Down
10 changes: 5 additions & 5 deletions routers/api/actions/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func ArtifactsRoutes(prefix string) *web.Router {

m.Group(artifactRouteBase, func() {
// retrieve, list and confirm artifacts
m.Combo("").Get(r.listArtifacts).Post(r.getUploadArtifactURL).Patch(r.comfirmUploadArtifact)
m.Combo("").Get(r.listArtifacts).Post(r.getUploadArtifactURL).Patch(r.confirmUploadArtifact)
// handle container artifacts list and download
m.Put("/{artifact_hash}/upload", r.uploadArtifact)
// handle artifacts download
Expand Down Expand Up @@ -297,9 +297,9 @@ func (ar artifactRoutes) uploadArtifact(ctx *ArtifactContext) {
})
}

// comfirmUploadArtifact confirm upload artifact.
// confirmUploadArtifact confirm upload artifact.
// if all chunks are uploaded, merge them to one file.
func (ar artifactRoutes) comfirmUploadArtifact(ctx *ArtifactContext) {
func (ar artifactRoutes) confirmUploadArtifact(ctx *ArtifactContext) {
_, runID, ok := validateRunID(ctx)
if !ok {
return
Expand Down Expand Up @@ -419,8 +419,8 @@ func (ar artifactRoutes) getDownloadArtifactURL(ctx *ArtifactContext) {
}

if itemPath != artifacts[0].ArtifactName {
log.Error("Error dismatch artifact name, itemPath: %v, artifact: %v", itemPath, artifacts[0].ArtifactName)
ctx.HTTPError(http.StatusBadRequest, "Error dismatch artifact name")
log.Error("Error mismatch artifact name, itemPath: %v, artifact: %v", itemPath, artifacts[0].ArtifactName)
ctx.HTTPError(http.StatusBadRequest, "Error mismatch artifact name")
return
}

Expand Down
6 changes: 3 additions & 3 deletions routers/api/actions/artifactsv4.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ func (r *artifactV4Routes) createArtifact(ctx *ArtifactContext) {

artifactName := req.Name

rententionDays := setting.Actions.ArtifactRetentionDays
retentionDays := setting.Actions.ArtifactRetentionDays
if req.ExpiresAt != nil {
rententionDays = int64(time.Until(req.ExpiresAt.AsTime()).Hours() / 24)
retentionDays = int64(time.Until(req.ExpiresAt.AsTime()).Hours() / 24)
}
// create or get artifact with name and path
artifact, err := actions.CreateArtifact(ctx, ctx.ActionTask, artifactName, artifactName+".zip", rententionDays)
artifact, err := actions.CreateArtifact(ctx, ctx.ActionTask, artifactName, artifactName+".zip", retentionDays)
if err != nil {
log.Error("Error create or get artifact: %v", err)
ctx.HTTPError(http.StatusInternalServerError, "Error create or get artifact")
Expand Down
4 changes: 2 additions & 2 deletions routers/api/packages/arch/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func UploadPackageFile(ctx *context.Context) {
return
}

release, err := arch_service.AquireRegistryLock(ctx, ctx.Package.Owner.ID)
release, err := arch_service.AcquireRegistryLock(ctx, ctx.Package.Owner.ID)
if err != nil {
apiError(ctx, http.StatusInternalServerError, err)
return
Expand Down Expand Up @@ -257,7 +257,7 @@ func DeletePackageVersion(ctx *context.Context) {
name := ctx.PathParam("name")
version := ctx.PathParam("version")

release, err := arch_service.AquireRegistryLock(ctx, ctx.Package.Owner.ID)
release, err := arch_service.AcquireRegistryLock(ctx, ctx.Package.Owner.ID)
if err != nil {
apiError(ctx, http.StatusInternalServerError, err)
return
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/org/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
webhook_service "code.gitea.io/gitea/services/webhook"
)

// ListHooks list an organziation's webhooks
// ListHooks list an organization's webhooks
func ListHooks(ctx *context.APIContext) {
// swagger:operation GET /orgs/{org}/hooks organization orgListHooks
// ---
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/org/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ func SearchTeam(ctx *context.APIContext) {
ListOptions: listOptions,
}

// Only admin is allowd to search for all teams
// Only admin is allowed to search for all teams
if !ctx.Doer.IsAdmin {
opts.UserID = ctx.Doer.ID
}
Expand Down
2 changes: 1 addition & 1 deletion routers/common/markup.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func RenderMarkup(ctx *context.Base, ctxRepo *context.Repository, mode, text, ur
return
}

// Ideally, this handler should be called with RepoAssigment and get the related repo from context "/owner/repo/markup"
// Ideally, this handler should be called with RepoAssignment and get the related repo from context "/owner/repo/markup"
// then render could use the repo to do various things (the permission check has passed)
//
// However, this handler is also exposed as "/markup" without any repo context,
Expand Down
2 changes: 1 addition & 1 deletion routers/web/healthcheck/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type componentStatus struct {
// And keep in mind: this health check should NEVER be used as a "restart" trigger, for example: Docker's "HEALTHCHECK".
// * If Gitea is upgrading and migrating database, there will be a long time before this endpoint starts to return "pass" status.
// In this case, if the checker restarts Gitea just because it doesn't get "pass" status in short time,
// the instance will just be restarted again and again before the migation finishes and the sitution just goes worse.
// the instance will just be restarted again and again before the migration finishes and the situation just goes worse.
func Check(w http.ResponseWriter, r *http.Request) {
rsp := response{
Status: pass,
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/issue_dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func RemoveDependency(ctx *context.Context) {
case "blocking":
depType = issues_model.DependencyTypeBlocking
default:
ctx.HTTPError(http.StatusBadRequest, "GetDependecyType")
ctx.HTTPError(http.StatusBadRequest, "GetDependencyType")
return
}

Expand Down
4 changes: 2 additions & 2 deletions routers/web/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ func SearchRepo(ctx *context.Context) {

ctx.SetTotalCountHeader(count)

latestCommitStatuses, err := commitstatus_service.FindReposLastestCommitStatuses(ctx, repos)
latestCommitStatuses, err := commitstatus_service.FindReposLatestCommitStatuses(ctx, repos)
if err != nil {
log.Error("FindReposLastestCommitStatuses: %v", err)
log.Error("FindReposLatestCommitStatuses: %v", err)
ctx.JSON(http.StatusInternalServerError, nil)
return
}
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/setting/collaboration.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func DeleteTeam(ctx *context.Context) {
}

if err = repo_service.RemoveRepositoryFromTeam(ctx, team, ctx.Repo.Repository.ID); err != nil {
ctx.ServerError("team.RemoveRepositorys", err)
ctx.ServerError("team.RemoveRepositories", err)
return
}

Expand Down
6 changes: 3 additions & 3 deletions services/issue/assignee.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
// DeleteNotPassedAssignee deletes all assignees who aren't passed via the "assignees" array
func DeleteNotPassedAssignee(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, assignees []*user_model.User) (err error) {
var found bool
oriAssignes := make([]*user_model.User, len(issue.Assignees))
_ = copy(oriAssignes, issue.Assignees)
oriAssignees := make([]*user_model.User, len(issue.Assignees))
_ = copy(oriAssignees, issue.Assignees)

for _, assignee := range oriAssignes {
for _, assignee := range oriAssignees {
found = false
for _, alreadyAssignee := range assignees {
if assignee.ID == alreadyAssignee.ID {
Expand Down
4 changes: 2 additions & 2 deletions services/issue/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func PullRequestCodeOwnersReview(ctx context.Context, pr *issues_model.PullReque
}

// load all reviews from database
latestReivews, _, err := issues_model.GetReviewsByIssueID(ctx, pr.IssueID)
latestReviews, _, err := issues_model.GetReviewsByIssueID(ctx, pr.IssueID)
if err != nil {
return nil, err
}
Expand All @@ -128,7 +128,7 @@ func PullRequestCodeOwnersReview(ctx context.Context, pr *issues_model.PullReque
}

for _, u := range uniqUsers {
if u.ID != issue.Poster.ID && !contain(latestReivews, u) {
if u.ID != issue.Poster.ID && !contain(latestReviews, u) {
comment, err := issues_model.AddReviewRequest(ctx, issue, u, issue.Poster, true)
if err != nil {
log.Warn("Failed add assignee user: %s to PR review: %s#%d, error: %s", u.Name, pr.BaseRepo.Name, pr.ID, err)
Expand Down
2 changes: 1 addition & 1 deletion services/migrations/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func assertRepositoryEqual(t *testing.T, expected, actual *base.Repository) {

func assertReviewEqual(t *testing.T, expected, actual *base.Review) {
assert.Equal(t, expected.ID, actual.ID, "ID")
assert.Equal(t, expected.IssueIndex, actual.IssueIndex, "IsssueIndex")
assert.Equal(t, expected.IssueIndex, actual.IssueIndex, "IssueIndex")
assert.Equal(t, expected.ReviewerID, actual.ReviewerID, "ReviewerID")
assert.Equal(t, expected.ReviewerName, actual.ReviewerName, "ReviewerName")
assert.Equal(t, expected.Official, actual.Official, "Official")
Expand Down
4 changes: 2 additions & 2 deletions services/org/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ func removeTeamMember(ctx context.Context, team *organization.Team, user *user_m
return err
}

// Remove watches from now unaccessible
// Remove watches from now inaccessible
if err := repo_service.ReconsiderWatches(ctx, repo, user); err != nil {
return err
}

// Remove issue assignments from now unaccessible
// Remove issue assignments from now inaccessible
if err := repo_service.ReconsiderRepoIssuesAssignee(ctx, repo, user); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion services/packages/arch/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
IndexArchiveFilename = "packages.db"
)

func AquireRegistryLock(ctx context.Context, ownerID int64) (globallock.ReleaseFunc, error) {
func AcquireRegistryLock(ctx context.Context, ownerID int64) (globallock.ReleaseFunc, error) {
return globallock.Lock(ctx, fmt.Sprintf("packages_arch_%d", ownerID))
}

Expand Down
2 changes: 1 addition & 1 deletion services/packages/cleanup/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func executeCleanupOneRule(ctx context.Context, pcr *packages_model.PackageClean
return fmt.Errorf("CleanupRule [%d]: rpm.BuildAllRepositoryFiles failed: %w", pcr.ID, err)
}
case packages_model.TypeArch:
release, err := arch_service.AquireRegistryLock(ctx, pcr.OwnerID)
release, err := arch_service.AcquireRegistryLock(ctx, pcr.OwnerID)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions services/packages/container/blob_uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
var (
// errWriteAfterRead occurs if Write is called after a read operation
errWriteAfterRead = errors.New("write is unsupported after a read operation")
// errOffsetMissmatch occurs if the file offset is different than the model
errOffsetMissmatch = errors.New("offset mismatch between file and model")
// errOffsetMismatch occurs if the file offset is different than the model
errOffsetMismatch = errors.New("offset mismatch between file and model")
)

// BlobUploader handles chunked blob uploads
Expand Down Expand Up @@ -86,7 +86,7 @@ func (u *BlobUploader) Append(ctx context.Context, r io.Reader) error {
return err
}
if offset != u.BytesReceived {
return errOffsetMissmatch
return errOffsetMismatch
}

n, err := io.Copy(io.MultiWriter(u.file, u.MultiHasher), r)
Expand Down
Loading