diff --git a/cmd/hook.go b/cmd/hook.go index 82dcb30866..d3eb4dea89 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -568,7 +568,7 @@ Forgejo or set your environment appropriately.`, "") hookOptions.RefFullNames = make([]git.RefName, 0, hookBatchSize) for { - // note: pktLineTypeUnknow means pktLineTypeFlush and pktLineTypeData all allowed + // note: pktLineTypeUnknown means pktLineTypeFlush and pktLineTypeData all allowed rs, err = readPktLine(ctx, reader, pktLineTypeUnknown) if err != nil { return err diff --git a/cmd/mailer.go b/cmd/mailer.go index d05d6c849b..2576e60b58 100644 --- a/cmd/mailer.go +++ b/cmd/mailer.go @@ -24,10 +24,10 @@ func runSendMail(ctx context.Context, c *cli.Command) error { } 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") } diff --git a/models/actions/run.go b/models/actions/run.go index 126a4e7e38..e500d45487 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -314,11 +314,11 @@ func GetRunsNotDoneByRepoIDAndPullRequestID(ctx context.Context, repoID, pullReq // The title will be cut off at 255 characters if it's longer than 255 characters. // We don't have to send the ActionRunNowDone notification here because there are no runs that start in a not done status. func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWorkflow) error { - ctx, commiter, err := db.TxContext(ctx) + ctx, committer, err := db.TxContext(ctx) if err != nil { return err } - defer commiter.Close() + defer committer.Close() index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID) if err != nil { @@ -345,7 +345,7 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork return err } - return commiter.Commit() + return committer.Commit() } // Adds `ActionRunJob` instances from `SingleWorkflows` to an existing ActionRun. diff --git a/models/actions/task.go b/models/actions/task.go index 45f1643989..3cf8a3af04 100644 --- a/models/actions/task.go +++ b/models/actions/task.go @@ -321,11 +321,11 @@ func GetAvailableJobsForRunner(e db.Engine, runner *ActionRunner) ([]*ActionRunJ } func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask, bool, error) { - ctx, commiter, err := db.TxContext(ctx) + ctx, committer, err := db.TxContext(ctx) if err != nil { return nil, false, err } - defer commiter.Close() + defer committer.Close() e := db.GetEngine(ctx) @@ -414,7 +414,7 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask task.Job = job - if err := commiter.Commit(); err != nil { + if err := committer.Commit(); err != nil { return nil, false, err } diff --git a/models/actions/tasks_version.go b/models/actions/tasks_version.go index a5c357888f..8678f052f0 100644 --- a/models/actions/tasks_version.go +++ b/models/actions/tasks_version.go @@ -73,11 +73,11 @@ func increaseTasksVersionByScope(ctx context.Context, ownerID, repoID int64) err } func IncreaseTaskVersion(ctx context.Context, ownerID, repoID int64) error { - ctx, commiter, err := db.TxContext(ctx) + ctx, committer, err := db.TxContext(ctx) if err != nil { return err } - defer commiter.Close() + defer committer.Close() // 1. increase global if err := increaseTasksVersionByScope(ctx, 0, 0); err != nil { @@ -101,5 +101,5 @@ func IncreaseTaskVersion(ctx context.Context, ownerID, repoID int64) error { } } - return commiter.Commit() + return committer.Commit() } diff --git a/models/asymkey/ssh_key_object_verification_test.go b/models/asymkey/ssh_key_object_verification_test.go index 4bfd79d56e..27d8d66a3c 100644 --- a/models/asymkey/ssh_key_object_verification_test.go +++ b/models/asymkey/ssh_key_object_verification_test.go @@ -24,14 +24,14 @@ func TestParseCommitWithSSHSignature(t *testing.T) { user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) sshKey := unittest.AssertExistsAndLoadBean(t, &PublicKey{ID: 1000, OwnerID: 2}) - t.Run("No commiter", func(t *testing.T) { + t.Run("No committer", func(t *testing.T) { o := commitToGitObject(&git.Commit{}) commitVerification := ParseObjectWithSSHSignature(db.DefaultContext, &o, &user_model.User{}) assert.False(t, commitVerification.Verified) assert.Equal(t, NoKeyFound, commitVerification.Reason) }) - t.Run("Commiter without keys", func(t *testing.T) { + t.Run("Committer without keys", func(t *testing.T) { user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) o := commitToGitObject(&git.Commit{Committer: &git.Signature{Email: user.Email}}) diff --git a/models/db/index.go b/models/db/index.go index c069f0febd..923576edb3 100644 --- a/models/db/index.go +++ b/models/db/index.go @@ -20,8 +20,8 @@ type ResourceIndex struct { } var ( - // ErrResouceOutdated represents an error when request resource outdated - ErrResouceOutdated = errors.New("resource outdated") + // ErrResourceOutdated represents an error when request resource outdated + ErrResourceOutdated = errors.New("resource outdated") // ErrGetResourceIndexFailed represents an error when resource index retries 3 times ErrGetResourceIndexFailed = errors.New("get resource index failed") ) diff --git a/models/forgejo_migrations/migrate_test.go b/models/forgejo_migrations/migrate_test.go index 360f6a16d5..87dea780d8 100644 --- a/models/forgejo_migrations/migrate_test.go +++ b/models/forgejo_migrations/migrate_test.go @@ -44,7 +44,7 @@ func TestRegisterMigration(t *testing.T) { "v99b_neat_migration.go", // no leading path "vb_neat_migration.go", // no version number "v12_neat_migration.go", // no migration group letter - "v12a-neat-migration.go", // no undescore + "v12a-neat-migration.go", // no underscore "v12a.go", // no descriptive identifier } { t.Run(fmt.Sprintf("bad name - %s", fn), func(t *testing.T) { diff --git a/models/forgejo_migrations_legacy/v33.go b/models/forgejo_migrations_legacy/v33.go index ce220d8179..b29c5feeb3 100644 --- a/models/forgejo_migrations_legacy/v33.go +++ b/models/forgejo_migrations_legacy/v33.go @@ -52,7 +52,7 @@ func addFederatedUserActivityTables(x *xorm.Engine) { FollowingUserID int64 `xorm:"NOT NULL unique(fuf_rel)"` } - // Add InboxPath to FederatedUser & add index fo UserID + // Add InboxPath to FederatedUser & add index to UserID type FederatedUser struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"NOT NULL INDEX user_id"` diff --git a/models/git/branch_test.go b/models/git/branch_test.go index 4340e8f729..5eca70324d 100644 --- a/models/git/branch_test.go +++ b/models/git/branch_test.go @@ -115,7 +115,7 @@ func TestFindRenamedBranch(t *testing.T) { assert.True(t, exist) assert.Equal(t, "master", branch.To) - _, exist, err = git_model.FindRenamedBranch(db.DefaultContext, 1, "unknow") + _, exist, err = git_model.FindRenamedBranch(db.DefaultContext, 1, "unknown") require.NoError(t, err) assert.False(t, exist) } diff --git a/models/git/protected_branch_list.go b/models/git/protected_branch_list.go index c7a3154884..54930b7eac 100644 --- a/models/git/protected_branch_list.go +++ b/models/git/protected_branch_list.go @@ -50,7 +50,7 @@ func FindRepoProtectedBranchRules(ctx context.Context, repoID int64) (ProtectedB func FindAllMatchedBranches(ctx context.Context, repoID int64, ruleName string) ([]string, error) { results := make([]string, 0, 10) for page := 1; ; page++ { - brancheNames, err := FindBranchNames(ctx, FindBranchOptions{ + branchNames, err := FindBranchNames(ctx, FindBranchOptions{ ListOptions: db.ListOptions{ PageSize: 100, Page: page, @@ -63,12 +63,12 @@ func FindAllMatchedBranches(ctx context.Context, repoID int64, ruleName string) } rule := glob.MustCompile(ruleName) - for _, branch := range brancheNames { + for _, branch := range branchNames { if rule.Match(branch) { results = append(results, branch) } } - if len(brancheNames) < 100 { + if len(branchNames) < 100 { break } } diff --git a/models/gitea_migrations/migrations.go b/models/gitea_migrations/migrations.go index 5d6bf0aab2..9b30f9940d 100644 --- a/models/gitea_migrations/migrations.go +++ b/models/gitea_migrations/migrations.go @@ -126,7 +126,7 @@ func prepareMigrationTasks() []*migration { newMigration(102, "update migration repositories' service type", v1_11.DropColumnHeadUserNameOnPullRequest), newMigration(103, "Add WhitelistDeployKeys to protected branch", v1_11.AddWhitelistDeployKeysToBranches), - newMigration(104, "remove unnecessary columns from label", v1_11.RemoveLabelUneededCols), + newMigration(104, "remove unnecessary columns from label", v1_11.RemoveLabelUnneededCols), newMigration(105, "add includes_all_repositories to teams", v1_11.AddTeamIncludesAllRepositories), newMigration(106, "add column `mode` to table watch", v1_11.AddModeColumnToWatch), newMigration(107, "Add template options to repository", v1_11.AddTemplateToRepo), @@ -323,7 +323,7 @@ func prepareMigrationTasks() []*migration { newMigration(268, "Update Action Ref", v1_21.UpdateActionsRefIndex), newMigration(269, "Drop deleted branch table", v1_21.DropDeletedBranchTable), newMigration(270, "Fix PackageProperty typo", v1_21.FixPackagePropertyTypo), - newMigration(271, "Allow archiving labels", v1_21.AddArchivedUnixColumInLabelTable), + newMigration(271, "Allow archiving labels", v1_21.AddArchivedUnixColumnInLabelTable), newMigration(272, "Add Version to ActionRun table", v1_21.AddVersionToActionRunTable), newMigration(273, "Add Action Schedule Table", v1_21.AddActionScheduleTable), newMigration(274, "Add Actions artifacts expiration date", v1_21.AddExpiredUnixColumnInActionArtifactTable), diff --git a/models/gitea_migrations/v1_11/v104.go b/models/gitea_migrations/v1_11/v104.go index 47cf320359..606690009d 100644 --- a/models/gitea_migrations/v1_11/v104.go +++ b/models/gitea_migrations/v1_11/v104.go @@ -9,7 +9,7 @@ import ( "xorm.io/xorm" ) -func RemoveLabelUneededCols(x *xorm.Engine) error { +func RemoveLabelUnneededCols(x *xorm.Engine) error { // Make sure the columns exist before dropping them type Label struct { QueryString string diff --git a/models/gitea_migrations/v1_11/v111.go b/models/gitea_migrations/v1_11/v111.go index 6f531e4858..fcd2ee7be3 100644 --- a/models/gitea_migrations/v1_11/v111.go +++ b/models/gitea_migrations/v1_11/v111.go @@ -410,7 +410,7 @@ func AddBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error { official, err := isOfficialReviewer(sess, review.IssueID, reviewer) if err != nil { - // Branch might not be proteced or other error, ignore it. + // Branch might not be protected or other error, ignore it. continue } review.Official = official diff --git a/models/gitea_migrations/v1_15/v182.go b/models/gitea_migrations/v1_15/v182.go index f53ff11df9..069f9890cd 100644 --- a/models/gitea_migrations/v1_15/v182.go +++ b/models/gitea_migrations/v1_15/v182.go @@ -24,7 +24,7 @@ func AddIssueResourceIndexTable(x *xorm.Engine) error { return err } - // Remove data we're goint to rebuild + // Remove data we're going to rebuild if _, err := sess.Table("issue_index").Where("1=1").Delete(&ResourceIndex{}); err != nil { return err } diff --git a/models/gitea_migrations/v1_21/v271.go b/models/gitea_migrations/v1_21/v271.go index e3ce2d4b74..38b171c323 100644 --- a/models/gitea_migrations/v1_21/v271.go +++ b/models/gitea_migrations/v1_21/v271.go @@ -9,7 +9,7 @@ import ( "xorm.io/xorm" ) -func AddArchivedUnixColumInLabelTable(x *xorm.Engine) error { +func AddArchivedUnixColumnInLabelTable(x *xorm.Engine) error { type Label struct { ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT NULL"` } diff --git a/models/org_team.go b/models/org_team.go index ecda43f0a9..de54c61745 100644 --- a/models/org_team.go +++ b/models/org_team.go @@ -116,7 +116,7 @@ func removeAllRepositories(ctx context.Context, t *organization.Team) (err error return err } - // Remove watches from all users and now unaccessible repos + // Remove watches from all users and now inaccessible repos for _, user := range t.Members { has, err := access_model.HasAccess(ctx, user.ID, repo) if err != nil { @@ -480,12 +480,12 @@ func removeTeamMember(ctx context.Context, team *organization.Team, userID int64 return err } - // Remove watches from now unaccessible + // Remove watches from now inaccessible if err := ReconsiderWatches(ctx, repo, userID); err != nil { return err } - // Remove issue assignments from now unaccessible + // Remove issue assignments from now inaccessible if err := ReconsiderRepoIssuesAssignee(ctx, repo, userID); err != nil { return err } diff --git a/models/organization/org.go b/models/organization/org.go index 6da8886c2f..82c3e0ea67 100644 --- a/models/organization/org.go +++ b/models/organization/org.go @@ -191,7 +191,7 @@ func (org *Organization) IsGhost() bool { return org.AsUser().IsGhost() } -// FindOrgMembersOpts represensts find org members conditions +// FindOrgMembersOpts represents find org members conditions type FindOrgMembersOpts struct { db.ListOptions Doer *user_model.User diff --git a/models/repo_transfer.go b/models/repo_transfer.go index f515f1bcf0..8031a20964 100644 --- a/models/repo_transfer.go +++ b/models/repo_transfer.go @@ -175,11 +175,11 @@ func CreatePendingRepositoryTransfer(ctx context.Context, doer, newOwner *user_m } // GetPendingTransfers returns the pending transfers of recipient which were sent by by doer. -func GetPendingTransferIDs(ctx context.Context, reciepientID, doerID int64) ([]int64, error) { +func GetPendingTransferIDs(ctx context.Context, recipientID, doerID int64) ([]int64, error) { pendingTransferIDs := make([]int64, 0, 8) return pendingTransferIDs, db.GetEngine(ctx).Table("repo_transfer"). Where("doer_id = ?", doerID). - And("recipient_id = ?", reciepientID). + And("recipient_id = ?", recipientID). Cols("id"). Find(&pendingTransferIDs) } diff --git a/models/repo_transfer_test.go b/models/repo_transfer_test.go index 7f01ac2b97..58fc63a263 100644 --- a/models/repo_transfer_test.go +++ b/models/repo_transfer_test.go @@ -17,10 +17,10 @@ import ( func TestGetPendingTransferIDs(t *testing.T) { require.NoError(t, unittest.PrepareTestDatabase()) doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3}) - reciepient := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) - pendingTransfer := unittest.AssertExistsAndLoadBean(t, &RepoTransfer{RecipientID: reciepient.ID, DoerID: doer.ID}) + recipient := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) + pendingTransfer := unittest.AssertExistsAndLoadBean(t, &RepoTransfer{RecipientID: recipient.ID, DoerID: doer.ID}) - pendingTransferIDs, err := GetPendingTransferIDs(db.DefaultContext, reciepient.ID, doer.ID) + pendingTransferIDs, err := GetPendingTransferIDs(db.DefaultContext, recipient.ID, doer.ID) require.NoError(t, err) if assert.Len(t, pendingTransferIDs, 1) { assert.Equal(t, pendingTransfer.ID, pendingTransferIDs[0]) diff --git a/models/unit/unit.go b/models/unit/unit.go index 6b4f2765ee..2f8306d45f 100644 --- a/models/unit/unit.go +++ b/models/unit/unit.go @@ -431,7 +431,7 @@ func AllUnitKeyNames() []string { return res } -// MinUnitAccessMode returns the minial permission of the permission map +// MinUnitAccessMode returns the minimal permission of the permission map func MinUnitAccessMode(unitsMap map[Type]perm.AccessMode) perm.AccessMode { res := perm.AccessModeNone for t, mode := range unitsMap { @@ -440,7 +440,7 @@ func MinUnitAccessMode(unitsMap map[Type]perm.AccessMode) perm.AccessMode { continue } - // get the minial permission great than AccessModeNone except all are AccessModeNone + // get the minimal permission greater than AccessModeNone except all are AccessModeNone if mode > perm.AccessModeNone && (res == perm.AccessModeNone || mode < res) { res = mode } diff --git a/modules/auth/password/hash/setting.go b/modules/auth/password/hash/setting.go index 05cd36fe3c..24d0f726c7 100644 --- a/modules/auth/password/hash/setting.go +++ b/modules/auth/password/hash/setting.go @@ -14,7 +14,7 @@ const DefaultHashAlgorithmName = "pbkdf2_hi" 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 diff --git a/modules/cache/mutex_map_test.go b/modules/cache/mutex_map_test.go index 324b3228d8..7dd21c2f56 100644 --- a/modules/cache/mutex_map_test.go +++ b/modules/cache/mutex_map_test.go @@ -57,7 +57,7 @@ func TestMutexMap_DifferentKeys(t *testing.T) { done := make(chan bool, 1) go func() { - // If these somehow refered to the same underlying `sync.Mutex`, because `sync.Mutex` is not re-entrant this would + // If these somehow referred to the same underlying `sync.Mutex`, because `sync.Mutex` is not re-entrant this would // never complete. unlock1 := mm.Lock("test-key-1") unlock2 := mm.Lock("test-key-2") diff --git a/modules/charset/escape.go b/modules/charset/escape.go index 57b13c1f18..5b185b1608 100644 --- a/modules/charset/escape.go +++ b/modules/charset/escape.go @@ -30,7 +30,7 @@ const ( WikiContext escapeContext = "wiki" // Rendered content (except markup), source code and blames. FileviewContext escapeContext = "file-view" - // Commits or pull requet's diff. + // Commits or pull request's diff. DiffContext escapeContext = "diff" ) diff --git a/modules/git/diff.go b/modules/git/diff.go index 0ba9c60912..f745531edd 100644 --- a/modules/git/diff.go +++ b/modules/git/diff.go @@ -100,7 +100,7 @@ func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diff } // ParseDiffHunkString parse the diffhunk content and return -func ParseDiffHunkString(diffhunk string) (leftLine, leftHunk, rightLine, righHunk int) { +func ParseDiffHunkString(diffhunk string) (leftLine, leftHunk, rightLine, rightHunk int) { ss := strings.Split(diffhunk, "@@") ranges := strings.Split(ss[1][1:], " ") leftRange := strings.Split(ranges[0], ",") @@ -112,14 +112,14 @@ func ParseDiffHunkString(diffhunk string) (leftLine, leftHunk, rightLine, righHu rightRange := strings.Split(ranges[1], ",") rightLine, _ = strconv.Atoi(rightRange[0]) if len(rightRange) > 1 { - righHunk, _ = strconv.Atoi(rightRange[1]) + rightHunk, _ = strconv.Atoi(rightRange[1]) } } else { log.Debug("Parse line number failed: %v", diffhunk) rightLine = leftLine - righHunk = leftHunk + rightHunk = leftHunk } - return leftLine, leftHunk, rightLine, righHunk + return leftLine, leftHunk, rightLine, rightHunk } // Example: @@ -1,8 +1,9 @@ => [..., 1, 8, 1, 9] diff --git a/modules/git/diff_compare_test.go b/modules/git/diff_compare_test.go index 433497b5c4..34c2017b8a 100644 --- a/modules/git/diff_compare_test.go +++ b/modules/git/diff_compare_test.go @@ -247,7 +247,7 @@ func TestCheckIfDiffDiffers(t *testing.T) { require.NoError(t, NewCommand(t.Context(), "switch", "-c", "e-2").Run(&RunOpts{Dir: tmpDir})) require.NoError(t, NewCommand(t.Context(), "rebase", "main-D-2").Run(&RunOpts{Dir: tmpDir})) - // The diff changed, because it no longers shows the change made to `README`. + // The diff changed, because it no longer shows the change made to `README`. changed, err := gitRepo.CheckIfDiffDiffers("main-D-2", "e-1", "e-2", nil) require.NoError(t, err) assert.False(t, changed) // This should be true. diff --git a/modules/git/diff_test.go b/modules/git/diff_test.go index 9130767c66..34e0695fea 100644 --- a/modules/git/diff_test.go +++ b/modules/git/diff_test.go @@ -30,7 +30,7 @@ index d8e4c92..19dc8ad 100644 @@ -1,9 +1,10 @@ --some comment --- some comment 5 -+--some coment 2 ++--some comment 2 +-- some comment 3 create or replace procedure test(p1 varchar2) is @@ -135,7 +135,7 @@ func TestCutDiffAroundLine(t *testing.T) { @@ -1,9 +1,10 @@ --some comment --- some comment 5 -+--some coment 2` ++--some comment 2` assert.Equal(t, expected, minusDiff) // Handle minus diffs properly @@ -148,7 +148,7 @@ func TestCutDiffAroundLine(t *testing.T) { @@ -1,9 +1,10 @@ --some comment --- some comment 5 -+--some coment 2 ++--some comment 2 +-- some comment 3` assert.Equal(t, expected, minusDiff) diff --git a/modules/git/foreachref/format.go b/modules/git/foreachref/format.go index 97e8ee4724..75e315ad4a 100644 --- a/modules/git/foreachref/format.go +++ b/modules/git/foreachref/format.go @@ -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 { escaped := "" diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index bd7d5e2014..0ebdb0f8a0 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -473,7 +473,7 @@ func (repo *Repository) GetCommitsFromIDs(commitIDs []string, ignoreExistence bo // It's entirely possible the commit no longer exists, we only care // about the status and verification. Verification is no longer possible, // but getting the status is still possible with just the ID. We do have - // to assumme the commitID is not shortened, we cannot recover the full + // to assume the commitID is not shortened, we cannot recover the full // commitID. id, err := NewIDFromString(commitID) if err == nil { diff --git a/modules/keying/keying.go b/modules/keying/keying.go index a1a93419b1..751fd77521 100644 --- a/modules/keying/keying.go +++ b/modules/keying/keying.go @@ -151,7 +151,7 @@ func ColumnAndID(column string, id int64) []byte { // it's not bound to a particular table. The table should be part of the context // that the key was derived for, in which case it binds through that. Use this // over `ColumnAndID` if you're encrypting data that's stored inside JSON. -// jsonSelector must be a unambigous selector to the JSON field that stores the +// jsonSelector must be a unambiguous selector to the JSON field that stores the // encrypted data. func ColumnAndJSONSelectorAndID(column, jsonSelector string, id int64) []byte { return binary.BigEndian.AppendUint64(append(append([]byte(column), ':'), append([]byte(jsonSelector), ':')...), uint64(id)) diff --git a/modules/setting/storage.go b/modules/setting/storage.go index 532842064c..e458300727 100644 --- a/modules/setting/storage.go +++ b/modules/setting/storage.go @@ -136,11 +136,11 @@ func getStorageSectionByType(rootCfg ConfigProvider, typ string) (ConfigSection, targetType := targetSec.Key("STORAGE_TYPE").String() if targetType == "" { if !IsValidStorageType(StorageType(typ)) { - return nil, 0, fmt.Errorf("unknow storage type %q", typ) + return nil, 0, fmt.Errorf("unknown storage type %q", typ) } targetSec.Key("STORAGE_TYPE").SetValue(typ) } else if !IsValidStorageType(StorageType(targetType)) { - return nil, 0, fmt.Errorf("unknow storage type %q for section storage.%v", targetType, typ) + return nil, 0, fmt.Errorf("unknown storage type %q for section storage.%v", targetType, typ) } return targetSec, targetSecIsTyp, nil @@ -166,7 +166,7 @@ func getStorageTargetSection(rootCfg ConfigProvider, name, typ string, sec Confi } } - // check stoarge name thirdly + // check storage name thirdly targetSec, _ := rootCfg.GetSection(storageSectionName + "." + name) if targetSec != nil { targetType := targetSec.Key("STORAGE_TYPE").String() diff --git a/modules/structs/issue.go b/modules/structs/issue.go index 7b7397dc4b..6208c28be1 100644 --- a/modules/structs/issue.go +++ b/modules/structs/issue.go @@ -17,7 +17,7 @@ import ( type StateType string const ( - // StateOpen pr is opend + // StateOpen pr is opened StateOpen StateType = "open" // StateClosed pr is closed StateClosed StateType = "closed" diff --git a/modules/templates/util_render_test.go b/modules/templates/util_render_test.go index 3cfd572491..acf5353ca3 100644 --- a/modules/templates/util_render_test.go +++ b/modules/templates/util_render_test.go @@ -54,7 +54,7 @@ func TestApostrophesInMentions(t *testing.T) { assert.Equal(t, template.HTML("
@mention-user's comment
\n"), rendered) } -func TestNonExistantUserMention(t *testing.T) { +func TestNonExistentUserMention(t *testing.T) { rendered := RenderMarkdownToHtml(t.Context(), "@ThisUserDoesNotExist @mention-user") assert.Equal(t, template.HTML("@ThisUserDoesNotExist @mention-user
\n"), rendered) } diff --git a/modules/validation/validatable.go b/modules/validation/validatable.go index 7bcca03bf8..1b0d4aa382 100644 --- a/modules/validation/validatable.go +++ b/modules/validation/validatable.go @@ -34,9 +34,9 @@ type Validateable interface { } func IsValid(v Validateable) (bool, error) { - if valdationErrors := v.Validate(); len(valdationErrors) > 0 { + if validationErrors := v.Validate(); len(validationErrors) > 0 { typeof := reflect.TypeOf(v) - errString := strings.Join(valdationErrors, "\n") + errString := strings.Join(validationErrors, "\n") return false, ErrNotValid{fmt.Sprint(typeof, ": ", errString)} } diff --git a/routers/api/actions/artifacts.go b/routers/api/actions/artifacts.go index 85a1f5f5be..cf52886baa 100644 --- a/routers/api/actions/artifacts.go +++ b/routers/api/actions/artifacts.go @@ -112,7 +112,7 @@ func ArtifactsRoutes(prefix string) *web.Route { 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 @@ -310,9 +310,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 diff --git a/routers/api/actions/artifactsv4.go b/routers/api/actions/artifactsv4.go index dee5f1b2f3..97da6c1735 100644 --- a/routers/api/actions/artifactsv4.go +++ b/routers/api/actions/artifactsv4.go @@ -271,12 +271,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.Error(http.StatusInternalServerError, "Error create or get artifact") diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go index 5ddcf00233..aa0c51fa25 100644 --- a/routers/api/v1/org/hook.go +++ b/routers/api/v1/org/hook.go @@ -13,7 +13,7 @@ import ( webhook_service "forgejo.org/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 // --- diff --git a/routers/api/v1/repo/mirror.go b/routers/api/v1/repo/mirror.go index 0ff8993b5a..834c1d20e3 100644 --- a/routers/api/v1/repo/mirror.go +++ b/routers/api/v1/repo/mirror.go @@ -357,7 +357,7 @@ func CreatePushMirror(ctx *context.APIContext, mirrorOption *api.CreatePushMirro } if mirrorOption.UseSSH && (mirrorOption.RemoteUsername != "" || mirrorOption.RemotePassword != "") { - ctx.Error(http.StatusBadRequest, "CreatePushMirror", "'use_ssh' is mutually exclusive with 'remote_username' and 'remote_passoword'") + ctx.Error(http.StatusBadRequest, "CreatePushMirror", "'use_ssh' is mutually exclusive with 'remote_username' and 'remote_password'") return } diff --git a/routers/common/search.go b/routers/common/search.go index 40189baee1..4cf37a006e 100644 --- a/routers/common/search.go +++ b/routers/common/search.go @@ -34,7 +34,7 @@ func InitCodeSearchOptions(ctx *context.Context) (opts CodeSearchOptions) { // Also sets the ctx.Data fields "CodeSearchMode" and "CodeSearchOptions" // // NOTE: -// This is seperate from `InitCodeSearchOptions` +// This is separate from `InitCodeSearchOptions` // since this is specific the indexer and only used // where git-grep is not available. func CodeSearchIndexerMode(ctx *context.Context) (mode code_indexer.SearchMode) { diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go index 8e9d890a48..1785623855 100644 --- a/routers/web/org/teams.go +++ b/routers/web/org/teams.go @@ -313,7 +313,7 @@ func NewTeamPost(ctx *context.Context) { unitPerms := getUnitPerms(ctx.Req.Form, p) if p < perm.AccessModeAdmin { // if p is less than admin accessmode, then it should be general accessmode, - // so we should calculate the minial accessmode from units accessmodes. + // so we should calculate the minimal accessmode from units accessmodes. p = unit_model.MinUnitAccessMode(unitPerms) } @@ -480,7 +480,7 @@ func EditTeamPost(ctx *context.Context) { unitPerms := getUnitPerms(ctx.Req.Form, newAccessMode) if newAccessMode < perm.AccessModeAdmin { // if newAccessMode is less than admin accessmode, then it should be general accessmode, - // so we should calculate the minial accessmode from units accessmodes. + // so we should calculate the minimal accessmode from units accessmodes. newAccessMode = unit_model.MinUnitAccessMode(unitPerms) } isAuthChanged := false diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index ccbb3ac2eb..2948c1db3c 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -101,9 +101,9 @@ func getParentTreeFields(treePath string) (treeNames, treePaths []string) { } // getSelectableEmailAddresses returns which emails can be used by the user as -// email for a Git commiter. +// email for a Git committer. func getSelectableEmailAddresses(ctx *context.Context) ([]*user_model.ActivatedEmailAddress, error) { - // Retrieve emails that the user could use for commiter identity. + // Retrieve emails that the user could use for committer identity. commitEmails, err := user_model.GetActivatedEmailAddresses(ctx, ctx.Doer.ID) if err != nil { return nil, fmt.Errorf("GetActivatedEmailAddresses: %w", err) diff --git a/routers/web/repo/issue_dependency.go b/routers/web/repo/issue_dependency.go index 3764a6bd7e..0d9595f2a4 100644 --- a/routers/web/repo/issue_dependency.go +++ b/routers/web/repo/issue_dependency.go @@ -119,7 +119,7 @@ func RemoveDependency(ctx *context.Context) { case "blocking": depType = issues_model.DependencyTypeBlocking default: - ctx.Error(http.StatusBadRequest, "GetDependecyType") + ctx.Error(http.StatusBadRequest, "GetDependencyType") return } diff --git a/routers/web/repo/middlewares.go b/routers/web/repo/middlewares.go index 9aba447433..5fed4d937e 100644 --- a/routers/web/repo/middlewares.go +++ b/routers/web/repo/middlewares.go @@ -26,7 +26,7 @@ func SetEditorconfigIfExists(ctx *context.Context) { if err != nil && !git.IsErrNotExist(err) { description := fmt.Sprintf("Error while getting .editorconfig file: %v", err) if err := system_model.CreateRepositoryNotice(description); err != nil { - ctx.ServerError("ErrCreatingReporitoryNotice", err) + ctx.ServerError("ErrCreatingRepositoryNotice", err) } return } diff --git a/routers/web/repo/patch.go b/routers/web/repo/patch.go index 688ef19375..fe680d0ed6 100644 --- a/routers/web/repo/patch.go +++ b/routers/web/repo/patch.go @@ -87,7 +87,7 @@ func NewDiffPatchPost(ctx *context.Context) { message += "\n\n" + form.CommitMessage } - gitIdenitity := getGitIdentity(ctx, form.CommitMailID, tplPatchFile, &form) + gitIdentity := getGitIdentity(ctx, form.CommitMailID, tplPatchFile, &form) if ctx.Written() { return } @@ -98,8 +98,8 @@ func NewDiffPatchPost(ctx *context.Context) { NewBranch: branchName, Message: message, Content: strings.ReplaceAll(form.Content, "\r", ""), - Author: gitIdenitity, - Committer: gitIdenitity, + Author: gitIdentity, + Committer: gitIdentity, }) if err != nil { if git_model.IsErrBranchAlreadyExists(err) { diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index 493787ad8b..eca4c5f5e7 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -687,9 +687,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 } diff --git a/routers/web/repo/setting/setting.go b/routers/web/repo/setting/setting.go index 7047af9196..f7d0348634 100644 --- a/routers/web/repo/setting/setting.go +++ b/routers/web/repo/setting/setting.go @@ -99,7 +99,7 @@ func SettingsCtxData(ctx *context.Context) { ctx.Data["CanUseSSHMirroring"] = git.HasSSHExecutable } -// Units show a repositorys unit settings page +// Units show a repository's unit settings page func Units(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.units.units") ctx.Data["PageIsRepoSettingsUnits"] = true diff --git a/services/actions/log_test.go b/services/actions/log_test.go index c6debac5c0..51fee87b51 100644 --- a/services/actions/log_test.go +++ b/services/actions/log_test.go @@ -65,7 +65,7 @@ func TestServicesActions_transferLingeringLogs(t *testing.T) { unittest.AssertNotExistsBean(t, &dbfs_model.DbfsMeta{ID: lingeringLogID}) } - // third pass is happilly doing nothing + // third pass is happily doing nothing require.NoError(t, transferLingeringLogs(t.Context(), transferLingeringLogsOpts(now))) // verify the tasks that are not to be garbage collected are still present diff --git a/services/actions/run.go b/services/actions/run.go index 64228938f8..ed795f2a63 100644 --- a/services/actions/run.go +++ b/services/actions/run.go @@ -163,7 +163,7 @@ func checkJobWillRevisit(ctx context.Context, job *actions_model.ActionRunJob) ( } func checkJobRunsOnStaticMatrixError(ctx context.Context, job *actions_model.ActionRunJob) (bool, error) { - // If a job has a `runs-on` field that references a matrix dimension like `runs-on: ${{ matrix.platorm }}`, and + // If a job has a `runs-on` field that references a matrix dimension like `runs-on: ${{ matrix.platform }}`, and // `platform` is not part of the job's matrix at all, then it will be tagged as `HasIncompleteRunsOn` and will be // blocked forever. This only applies if the matrix is static -- that is, the job isn't also tagged // `HasIncompleteMatrix` and the matrix is yet to be fully defined. diff --git a/services/actions/task.go b/services/actions/task.go index 7b4e32571d..bbe17ac8b3 100644 --- a/services/actions/task.go +++ b/services/actions/task.go @@ -195,11 +195,11 @@ func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.Task stepStates[v.Id] = v } - ctx, commiter, err := db.TxContext(ctx) + ctx, committer, err := db.TxContext(ctx) if err != nil { return nil, err } - defer commiter.Close() + defer committer.Close() e := db.GetEngine(ctx) @@ -262,7 +262,7 @@ func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.Task } } - if err := commiter.Commit(); err != nil { + if err := committer.Commit(); err != nil { return nil, err } diff --git a/services/agit/agit.go b/services/agit/agit.go index 8ef641629a..01fc4bc168 100644 --- a/services/agit/agit.go +++ b/services/agit/agit.go @@ -59,7 +59,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git. // Get the anything after the refs/for/ prefix. baseBranchName := opts.RefFullNames[i].ForBranchName() - curentTopicBranch := topicBranch + currentTopicBranch := topicBranch // If the reference was given in the format of refs/for/