From 23b373e8a64424cd2f52fb647bed71ca13810083 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 16 Oct 2023 16:17:57 -0400 Subject: [PATCH] fix: add misspell check for linting codebase (#3865) * add misspell check * lint: fix misspell issues ``` server/events/vcs/instrumented_client.go:46:26: `soley` is a misspelling of `solely` (misspell) // methods and implement soley any github specific interfaces. ^ server/events/project_command_context_builder.go:49:5: `Conciously` is a misspelling of `Consciously` (misspell) // Conciously making this global since it gets flushed periodically anyways ^ server/controllers/events/gitlab_request_parser_validator.go:87:32: `noteable` is a misspelling of `notable` (misspell) NoteableType string `json:"noteable_type"` ^ server/controllers/events/gitlab_request_parser_validator_test.go:351:6: `noteable` is a misspelling of `notable` (misspell) "noteable_type": "MergeRequest", ^ server/controllers/events/gitlab_request_parser_validator_test.go:359:6: `noteable` is a misspelling of `notable` (misspell) "noteable_id": 7, ^ server/controllers/events/gitlab_request_parser_validator_test.go:467:6: `noteable` is a misspelling of `notable` (misspell) "noteable_type": "Commit", ^ server/controllers/events/gitlab_request_parser_validator_test.go:475:6: `noteable` is a misspelling of `notable` (misspell) "noteable_id": null, ^ server/events/event_parser_test.go:1012:23: `seperate` is a misspelling of `separate` (misspell) // If sha changes in seperate PR, ^ ``` Signed-off-by: Rui Chen * add locale setting Signed-off-by: Rui Chen * Revert "lint: fix misspell issues" This reverts commit 7cc56afa8e1d957d0db091c347a3e48aac394178. * lint: fix some misspell issues Signed-off-by: Rui Chen --------- Signed-off-by: Rui Chen Co-authored-by: PePe Amengual --- .golangci.yml | 15 ++++++++++++--- server/events/event_parser_test.go | 2 +- server/events/project_command_context_builder.go | 2 +- server/events/vcs/instrumented_client.go | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b6a224f24..63732fc9a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,14 +1,23 @@ +linters-settings: + misspell: + # Correct spellings using locale preferences for US or UK. + # Default is to use a neutral variety of English. + # Setting locale to US will correct the British spelling of 'colour' to 'color'. + # locale: US + ignore-words: + # for gitlab notes api + - noteable + linters: enable: - errcheck - gochecknoinits -# We don't use goconst because it gives false positives in the tests. -# - goconst - gofmt - - revive - gosec - gosimple - ineffassign + - misspell + - revive - staticcheck - typecheck - unconvert diff --git a/server/events/event_parser_test.go b/server/events/event_parser_test.go index d1ec65182..c25ce7f87 100644 --- a/server/events/event_parser_test.go +++ b/server/events/event_parser_test.go @@ -1009,7 +1009,7 @@ func TestBitBucketNonCodeChangesAreIgnored(t *testing.T) { act = parser.GetBitbucketCloudPullEventType("pullrequest:updated", "fakeSha2", "https://github.com/fakeorg/fakerepo/pull/1") Equals(t, models.UpdatedPullEvent, act) - // If sha changes in seperate PR, + // If sha changes in separate PR, act = parser.GetBitbucketCloudPullEventType("pullrequest:updated", "otherPRSha", "https://github.com/fakeorg/fakerepo/pull/2") Equals(t, models.UpdatedPullEvent, act) // We will still ignore same shas in first PR diff --git a/server/events/project_command_context_builder.go b/server/events/project_command_context_builder.go index 16714f841..0b4bf00f2 100644 --- a/server/events/project_command_context_builder.go +++ b/server/events/project_command_context_builder.go @@ -46,7 +46,7 @@ type ProjectCommandContextBuilder interface { // object relevant to the command it applies to. type CommandScopedStatsProjectCommandContextBuilder struct { ProjectCommandContextBuilder - // Conciously making this global since it gets flushed periodically anyways + // Consciously making this global since it gets flushed periodically anyways ProjectCounter tally.Counter } diff --git a/server/events/vcs/instrumented_client.go b/server/events/vcs/instrumented_client.go index 436b75e16..e77d2b798 100644 --- a/server/events/vcs/instrumented_client.go +++ b/server/events/vcs/instrumented_client.go @@ -43,7 +43,7 @@ type IGithubClient interface { } // InstrumentedGithubClient should delegate to the underlying InstrumentedClient for vcs provider-agnostic -// methods and implement soley any github specific interfaces. +// methods and implement solely any github specific interfaces. type InstrumentedGithubClient struct { *InstrumentedClient PullRequestGetter GithubPullRequestGetter