Skip to content

Commit 9b2536b

Browse files
authored
Update misspell to 0.5.1 and add misspellings.csv (#30573)
Misspell 0.5.0 supports passing a csv file to extend the list of misspellings, so I added some common ones from the codebase. There is at least one typo in a API response so we need to decided whether to revert that and then likely remove the dict entry.
1 parent dcc3c17 commit 9b2536b

File tree

34 files changed

+103
-82
lines changed

34 files changed

+103
-82
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-che
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected]
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
33-
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.4.1
33+
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.5.1
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@db51e79a0e37c572d8b59ae0c58bf2bbbbe53285
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
@@ -397,11 +397,11 @@ lint-md: node_modules
397397

398398
.PHONY: lint-spell
399399
lint-spell:
400-
@go run $(MISSPELL_PACKAGE) -error $(SPELLCHECK_FILES)
400+
@go run $(MISSPELL_PACKAGE) -dict tools/misspellings.csv -error $(SPELLCHECK_FILES)
401401

402402
.PHONY: lint-spell-fix
403403
lint-spell-fix:
404-
@go run $(MISSPELL_PACKAGE) -w $(SPELLCHECK_FILES)
404+
@go run $(MISSPELL_PACKAGE) -dict tools/misspellings.csv -w $(SPELLCHECK_FILES)
405405

406406
.PHONY: lint-go
407407
lint-go:

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ Defaultly every storage has their default base path like below
13221322
| actions_log | actions_log/ |
13231323
| actions_artifacts | actions_artifacts/ |
13241324

1325-
And bucket, basepath or `SERVE_DIRECT` could be special or overrided, if you want to use a different you can:
1325+
And bucket, basepath or `SERVE_DIRECT` could be special or overridden, if you want to use a different you can:
13261326

13271327
```ini
13281328
[storage.actions_log]

models/actions/run.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,11 @@ func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID strin
262262

263263
// InsertRun inserts a run
264264
func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWorkflow) error {
265-
ctx, commiter, err := db.TxContext(ctx)
265+
ctx, committer, err := db.TxContext(ctx)
266266
if err != nil {
267267
return err
268268
}
269-
defer commiter.Close()
269+
defer committer.Close()
270270

271271
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
272272
if err != nil {
@@ -331,7 +331,7 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork
331331
}
332332
}
333333

334-
return commiter.Commit()
334+
return committer.Commit()
335335
}
336336

337337
func GetRunByID(ctx context.Context, id int64) (*ActionRun, error) {

models/actions/task.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ func GetRunningTaskByToken(ctx context.Context, token string) (*ActionTask, erro
216216
}
217217

218218
func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask, bool, error) {
219-
ctx, commiter, err := db.TxContext(ctx)
219+
ctx, committer, err := db.TxContext(ctx)
220220
if err != nil {
221221
return nil, false, err
222222
}
223-
defer commiter.Close()
223+
defer committer.Close()
224224

225225
e := db.GetEngine(ctx)
226226

@@ -322,7 +322,7 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
322322

323323
task.Job = job
324324

325-
if err := commiter.Commit(); err != nil {
325+
if err := committer.Commit(); err != nil {
326326
return nil, false, err
327327
}
328328

@@ -347,11 +347,11 @@ func UpdateTaskByState(ctx context.Context, state *runnerv1.TaskState) (*ActionT
347347
stepStates[v.Id] = v
348348
}
349349

350-
ctx, commiter, err := db.TxContext(ctx)
350+
ctx, committer, err := db.TxContext(ctx)
351351
if err != nil {
352352
return nil, err
353353
}
354-
defer commiter.Close()
354+
defer committer.Close()
355355

356356
e := db.GetEngine(ctx)
357357

@@ -412,7 +412,7 @@ func UpdateTaskByState(ctx context.Context, state *runnerv1.TaskState) (*ActionT
412412
}
413413
}
414414

415-
if err := commiter.Commit(); err != nil {
415+
if err := committer.Commit(); err != nil {
416416
return nil, err
417417
}
418418

models/actions/tasks_version.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
// ActionTasksVersion
1515
// If both ownerID and repoID is zero, its scope is global.
16-
// If ownerID is not zero and repoID is zero, its scope is org (there is no user-level runner currrently).
16+
// If ownerID is not zero and repoID is zero, its scope is org (there is no user-level runner currently).
1717
// If ownerID is zero and repoID is not zero, its scope is repo.
1818
type ActionTasksVersion struct {
1919
ID int64 `xorm:"pk autoincr"`
@@ -73,11 +73,11 @@ func increaseTasksVersionByScope(ctx context.Context, ownerID, repoID int64) err
7373
}
7474

7575
func IncreaseTaskVersion(ctx context.Context, ownerID, repoID int64) error {
76-
ctx, commiter, err := db.TxContext(ctx)
76+
ctx, committer, err := db.TxContext(ctx)
7777
if err != nil {
7878
return err
7979
}
80-
defer commiter.Close()
80+
defer committer.Close()
8181

8282
// 1. increase global
8383
if err := increaseTasksVersionByScope(ctx, 0, 0); err != nil {
@@ -101,5 +101,5 @@ func IncreaseTaskVersion(ctx context.Context, ownerID, repoID int64) error {
101101
}
102102
}
103103

104-
return commiter.Commit()
104+
return committer.Commit()
105105
}

models/fixtures/pull_request.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-
22
id: 1
33
type: 0 # gitea pull request
4-
status: 2 # mergable
4+
status: 2 # mergeable
55
issue_id: 2
66
index: 2
77
head_repo_id: 1
@@ -16,7 +16,7 @@
1616
-
1717
id: 2
1818
type: 0 # gitea pull request
19-
status: 2 # mergable
19+
status: 2 # mergeable
2020
issue_id: 3
2121
index: 3
2222
head_repo_id: 1
@@ -29,7 +29,7 @@
2929
-
3030
id: 3
3131
type: 0 # gitea pull request
32-
status: 2 # mergable
32+
status: 2 # mergeable
3333
issue_id: 8
3434
index: 1
3535
head_repo_id: 11
@@ -42,7 +42,7 @@
4242
-
4343
id: 4
4444
type: 0 # gitea pull request
45-
status: 2 # mergable
45+
status: 2 # mergeable
4646
issue_id: 9
4747
index: 1
4848
head_repo_id: 48
@@ -55,7 +55,7 @@
5555
-
5656
id: 5 # this PR is outdated (one commit behind branch1 )
5757
type: 0 # gitea pull request
58-
status: 2 # mergable
58+
status: 2 # mergeable
5959
issue_id: 11
6060
index: 5
6161
head_repo_id: 1
@@ -68,7 +68,7 @@
6868
-
6969
id: 6
7070
type: 0 # gitea pull request
71-
status: 2 # mergable
71+
status: 2 # mergeable
7272
issue_id: 12
7373
index: 2
7474
head_repo_id: 3
@@ -81,7 +81,7 @@
8181
-
8282
id: 7
8383
type: 0 # gitea pull request
84-
status: 2 # mergable
84+
status: 2 # mergeable
8585
issue_id: 19
8686
index: 1
8787
head_repo_id: 58
@@ -94,7 +94,7 @@
9494
-
9595
id: 8
9696
type: 0 # gitea pull request
97-
status: 2 # mergable
97+
status: 2 # mergeable
9898
issue_id: 20
9999
index: 1
100100
head_repo_id: 23
@@ -103,7 +103,7 @@
103103
-
104104
id: 9
105105
type: 0 # gitea pull request
106-
status: 2 # mergable
106+
status: 2 # mergeable
107107
issue_id: 21
108108
index: 1
109109
head_repo_id: 60
@@ -112,7 +112,7 @@
112112
-
113113
id: 10
114114
type: 0 # gitea pull request
115-
status: 2 # mergable
115+
status: 2 # mergeable
116116
issue_id: 22
117117
index: 1
118118
head_repo_id: 61

models/issues/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ func UpdateAllowEdits(ctx context.Context, pr *PullRequest) error {
807807

808808
// Mergeable returns if the pullrequest is mergeable.
809809
func (pr *PullRequest) Mergeable(ctx context.Context) bool {
810-
// If a pull request isn't mergable if it's:
810+
// If a pull request isn't mergeable if it's:
811811
// - Being conflict checked.
812812
// - Has a conflict.
813813
// - Received a error while being conflict checked.

models/issues/tracked_time.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ func AddTime(ctx context.Context, user *user_model.User, issue *Issue, amount in
187187
Issue: issue,
188188
Repo: issue.Repo,
189189
Doer: user,
190-
// Content before v1.21 did store the formated string instead of seconds,
191-
// so use "|" as delimeter to mark the new format
190+
// Content before v1.21 did store the formatted string instead of seconds,
191+
// so use "|" as delimiter to mark the new format
192192
Content: fmt.Sprintf("|%d", amount),
193193
Type: CommentTypeAddTimeManual,
194194
TimeID: t.ID,
@@ -267,8 +267,8 @@ func DeleteIssueUserTimes(ctx context.Context, issue *Issue, user *user_model.Us
267267
Issue: issue,
268268
Repo: issue.Repo,
269269
Doer: user,
270-
// Content before v1.21 did store the formated string instead of seconds,
271-
// so use "|" as delimeter to mark the new format
270+
// Content before v1.21 did store the formatted string instead of seconds,
271+
// so use "|" as delimiter to mark the new format
272272
Content: fmt.Sprintf("|%d", removedTime),
273273
Type: CommentTypeDeleteTimeManual,
274274
}); err != nil {
@@ -298,8 +298,8 @@ func DeleteTime(ctx context.Context, t *TrackedTime) error {
298298
Issue: t.Issue,
299299
Repo: t.Issue.Repo,
300300
Doer: t.User,
301-
// Content before v1.21 did store the formated string instead of seconds,
302-
// so use "|" as delimeter to mark the new format
301+
// Content before v1.21 did store the formatted string instead of seconds,
302+
// so use "|" as delimiter to mark the new format
303303
Content: fmt.Sprintf("|%d", t.Time),
304304
Type: CommentTypeDeleteTimeManual,
305305
}); err != nil {

models/migrations/v1_17/v216.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
package v1_17 //nolint
55

66
// This migration added non-ideal indices to the action table which on larger datasets slowed things down
7-
// it has been superceded by v218.go
7+
// it has been superseded by v218.go

modules/git/ref.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (ref RefName) RefGroup() string {
184184
}
185185

186186
// RefType returns the simple ref type of the reference, e.g. branch, tag
187-
// It's differrent from RefGroup, which is using the name of the directory under .git/refs
187+
// It's different from RefGroup, which is using the name of the directory under .git/refs
188188
// Here we using branch but not heads, using tag but not tags
189189
func (ref RefName) RefType() string {
190190
var refType string

modules/process/manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,17 @@ func (pm *Manager) AddTypedContext(parent context.Context, description, processT
134134
//
135135
// Most processes will not need to use the cancel function but there will be cases whereby you want to cancel the process but not immediately remove it from the
136136
// process table.
137-
func (pm *Manager) AddContextTimeout(parent context.Context, timeout time.Duration, description string) (ctx context.Context, cancel context.CancelFunc, finshed FinishedFunc) {
137+
func (pm *Manager) AddContextTimeout(parent context.Context, timeout time.Duration, description string) (ctx context.Context, cancel context.CancelFunc, finished FinishedFunc) {
138138
if timeout <= 0 {
139139
// it's meaningless to use timeout <= 0, and it must be a bug! so we must panic here to tell developers to make the timeout correct
140140
panic("the timeout must be greater than zero, otherwise the context will be cancelled immediately")
141141
}
142142

143143
ctx, cancel = context.WithTimeout(parent, timeout)
144144

145-
ctx, _, finshed = pm.Add(ctx, description, cancel, NormalProcessType, true)
145+
ctx, _, finished = pm.Add(ctx, description, cancel, NormalProcessType, true)
146146

147-
return ctx, cancel, finshed
147+
return ctx, cancel, finished
148148
}
149149

150150
// Add create a new process

modules/templates/helper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ func TestSubjectBodySeparator(t *testing.T) {
4949
test("Multiple\n---\n-------\n---\nSeparators",
5050
"Multiple\n",
5151
"\n-------\n---\nSeparators")
52-
test("Insuficient\n--\nSeparators",
52+
test("Insufficient\n--\nSeparators",
5353
"",
54-
"Insuficient\n--\nSeparators")
54+
"Insufficient\n--\nSeparators")
5555
}
5656

5757
func TestJSEscapeSafe(t *testing.T) {

routers/api/actions/artifacts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func (ar artifactRoutes) uploadArtifact(ctx *ArtifactContext) {
301301
})
302302
}
303303

304-
// comfirmUploadArtifact comfirm upload artifact.
304+
// comfirmUploadArtifact confirm upload artifact.
305305
// if all chunks are uploaded, merge them to one file.
306306
func (ar artifactRoutes) comfirmUploadArtifact(ctx *ArtifactContext) {
307307
_, runID, ok := validateRunID(ctx)

routers/api/actions/runner/interceptor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
3636
uuid := request.Header().Get(uuidHeaderKey)
3737
token := request.Header().Get(tokenHeaderKey)
3838
// TODO: version will be removed from request header after Gitea 1.20 released.
39-
// And Gitea will not try to read version from reuqest header
39+
// And Gitea will not try to read version from request header
4040
version := request.Header().Get(versionHeaderKey)
4141

4242
runner, err := actions_model.GetRunnerByUUID(ctx, uuid)
@@ -53,7 +53,7 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
5353
cols := []string{"last_online"}
5454

5555
// TODO: version will be removed from request header after Gitea 1.20 released.
56-
// And Gitea will not try to read version from reuqest header
56+
// And Gitea will not try to read version from request header
5757
version, _ = util.SplitStringAtByteN(version, 64)
5858
if !util.IsEmptyString(version) && runner.Version != version {
5959
runner.Version = version

routers/api/packages/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The package registry code is divided into multiple modules to split the function
1919

2020
## Models
2121

22-
Every package registry implementation uses the same underlaying models:
22+
Every package registry implementation uses the same underlying models:
2323

2424
| Model | Description |
2525
| - | - |

routers/api/v1/shared/runners.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"code.gitea.io/gitea/services/context"
1313
)
1414

15-
// RegistrationToken is response related to registeration token
15+
// RegistrationToken is response related to registration token
1616
// swagger:response RegistrationToken
1717
type RegistrationToken struct {
1818
Token string `json:"token"`

routers/private/hook_pre_receive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func preReceiveBranch(ctx *preReceiveContext, oldCommitID, newCommitID string, r
359359
})
360360
return
361361
}
362-
log.Error("Unable to check if mergable: protected branch %s in %-v and pr #%d. Error: %v", ctx.opts.UserID, branchName, repo, pr.Index, err)
362+
log.Error("Unable to check if mergeable: protected branch %s in %-v and pr #%d. Error: %v", ctx.opts.UserID, branchName, repo, pr.Index, err)
363363
ctx.JSON(http.StatusInternalServerError, private.Response{
364364
Err: fmt.Sprintf("Unable to get status of pull request %d. Error: %v", ctx.opts.PullRequestID, err),
365365
})

routers/web/admin/orgs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func Organizations(ctx *context.Context) {
3030
explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{
3131
Actor: ctx.Doer,
3232
Type: user_model.UserTypeOrganization,
33-
IncludeReserved: true, // administrator needs to list all acounts include reserved
33+
IncludeReserved: true, // administrator needs to list all accounts include reserved
3434
ListOptions: db.ListOptions{
3535
PageSize: setting.UI.Admin.OrgPagingNum,
3636
},

routers/web/admin/users.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func Users(ctx *context.Context) {
8181
IsRestricted: util.OptionalBoolParse(statusFilterMap["is_restricted"]),
8282
IsTwoFactorEnabled: util.OptionalBoolParse(statusFilterMap["is_2fa_enabled"]),
8383
IsProhibitLogin: util.OptionalBoolParse(statusFilterMap["is_prohibit_login"]),
84-
IncludeReserved: true, // administrator needs to list all acounts include reserved, bot, remote ones
84+
IncludeReserved: true, // administrator needs to list all accounts include reserved, bot, remote ones
8585
ExtraParamStrings: extraParamStrings,
8686
}, tplUsers)
8787
}

routers/web/repo/compare.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ func CompareDiff(ctx *context.Context) {
812812
// applicable if you have one commit to compare and that commit has a message.
813813
// In that case the commit message will be prepend to the template body.
814814
if templateContent, ok := ctx.Data[pullRequestTemplateKey].(string); ok && templateContent != "" {
815-
// Re-use the same key as that's priortized over the "content" key.
815+
// Re-use the same key as that's prioritized over the "content" key.
816816
// Add two new lines between the content to ensure there's always at least
817817
// one empty line between them.
818818
ctx.Data[pullRequestTemplateKey] = content + "\n\n" + templateContent

0 commit comments

Comments
 (0)