From 3fdc6cb531a28ad9b08b2ae34f9297062441e35b Mon Sep 17 00:00:00 2001 From: John Tzikas Date: Tue, 1 Dec 2020 17:27:05 +0200 Subject: [PATCH] Fix misspellings and enable misspell on ci (#16285) Co-authored-by: Ben Schumacher --- .golangci.yml | 5 +++++ api4/channel_test.go | 2 +- api4/job_test.go | 2 +- app/app_iface.go | 2 +- app/channel.go | 2 +- app/license.go | 2 +- app/notification_push_test.go | 2 +- app/notification_test.go | 8 ++++---- config/feature_flags.go | 2 +- config/store.go | 2 +- model/command_autocomplete.go | 2 +- model/command_autocomplete_test.go | 4 ++-- model/feature_flags.go | 2 +- model/role.go | 2 +- model/search_params_test.go | 20 +++++++++---------- .../bleveengine/indexer/indexing_job.go | 2 +- store/errors.go | 6 +++--- store/sqlstore/channel_store_categories.go | 4 ++-- store/sqlstore/post_store_test.go | 4 ++-- store/storetest/group_store.go | 4 ++-- 20 files changed, 42 insertions(+), 37 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a846446ca6..0504e4b479 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,6 +26,7 @@ linters: - unconvert - unused - varcheck + - misspell # TODO: enable this later # - errcheck @@ -50,3 +51,7 @@ issues: # ignore golint error for a lot of packages for now - golint path: "api4|app|cmd|einterface|enterprise|jobs|migrations|mlog|model|testlib|services|store|utils|web|wsapi|plugin/plugintest/api.go|plugin/api.go|plugin/context.go|plugin/client.go|plugin/client_rpc.go|plugin/client_rpc_generated.go|plugin/api_timer_layer_generated.go|plugin/hooks_timer_layer_generated|plugin/environment.go|plugin/health_check.go|plugin/hooks.go|plugin/supervisor.go|plugin/valid.go" + + - linters: + - misspell + path: "utils/markdown/html_entities.go" diff --git a/api4/channel_test.go b/api4/channel_test.go index bc419379ec..1b2597ef13 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -3627,7 +3627,7 @@ func TestGetChannelModerations(t *testing.T) { } }) - t.Run("Retuns the correct value for manage_members depending on whether the channel is public or private", func(t *testing.T) { + t.Run("Returns the correct value for manage_members depending on whether the channel is public or private", func(t *testing.T) { scheme := th.SetupTeamScheme() team.SchemeId = &scheme.Id _, err := th.App.UpdateTeamScheme(team) diff --git a/api4/job_test.go b/api4/job_test.go index 896ec83630..50e810939d 100644 --- a/api4/job_test.go +++ b/api4/job_test.go @@ -199,7 +199,7 @@ func TestDownloadJob(t *testing.T) { _, resp = th.Client.DownloadJob(job.Id) CheckForbiddenStatus(t, resp) - // System admin trying to download the results of a non-existant job + // System admin trying to download the results of a non-existent job _, resp = th.SystemAdminClient.DownloadJob(job.Id) CheckNotFoundStatus(t, resp) diff --git a/app/app_iface.go b/app/app_iface.go index 7abdd2e0dc..da786f8328 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -228,7 +228,7 @@ type AppIface interface { // belong to users in the specified team, linking them to their users MentionsToTeamMembers(message, teamId string) model.UserMentionMap // MoveChannel method is prone to data races if someone joins to channel during the move process. However this - // function is only exposed to sysadmins and the possibility of this edge case is realtively small. + // function is only exposed to sysadmins and the possibility of this edge case is relatively small. MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError // NewWebConn returns a new WebConn instance. NewWebConn(ws *websocket.Conn, session model.Session, t goi18n.TranslateFunc, locale string) *WebConn diff --git a/app/channel.go b/app/channel.go index 8805704934..f3749a7bcc 100644 --- a/app/channel.go +++ b/app/channel.go @@ -2614,7 +2614,7 @@ func (a *App) RemoveAllDeactivatedMembersFromChannel(channel *model.Channel) *mo } // MoveChannel method is prone to data races if someone joins to channel during the move process. However this -// function is only exposed to sysadmins and the possibility of this edge case is realtively small. +// function is only exposed to sysadmins and the possibility of this edge case is relatively small. func (a *App) MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError { // Check that all channel members are in the destination team. channelMembers, err := a.GetChannelMembersPage(channel.Id, 0, 10000000) diff --git a/app/license.go b/app/license.go index ef3674ae75..080206dd7f 100644 --- a/app/license.go +++ b/app/license.go @@ -223,7 +223,7 @@ func (s *Server) GetSanitizedClientLicense() map[string]string { return sanitizedLicense } -// RequestTrialLicense request a trial license from the mattermost offical license server +// RequestTrialLicense request a trial license from the mattermost official license server func (s *Server) RequestTrialLicense(trialRequest *model.TrialLicenseRequest) *model.AppError { resp, err := http.Post(requestTrialURL, "application/json", bytes.NewBuffer([]byte(trialRequest.ToJson()))) if err != nil { diff --git a/app/notification_push_test.go b/app/notification_push_test.go index 948946fa37..9d3d107fdf 100644 --- a/app/notification_push_test.go +++ b/app/notification_push_test.go @@ -1252,7 +1252,7 @@ func TestSendAckToPushProxy(t *testing.T) { assert.Equal(t, ack.NotificationType, handler.notificationAcks()[0].NotificationType) } -// TestAllPushNotifications is a master test which sends all verious types +// TestAllPushNotifications is a master test which sends all various types // of notifications and verifies they have been properly sent. func TestAllPushNotifications(t *testing.T) { if testing.Short() { diff --git a/app/notification_test.go b/app/notification_test.go index e4e3ec6207..e50d1a174c 100644 --- a/app/notification_test.go +++ b/app/notification_test.go @@ -847,7 +847,7 @@ func TestGetExplicitMentions(t *testing.T) { OtherPotentialMentions: nil, }, }, - "matching group with preceeding @": { + "matching group with preceding @": { Message: "@engineering", Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}}, Expected: &ExplicitMentions{ @@ -858,7 +858,7 @@ func TestGetExplicitMentions(t *testing.T) { OtherPotentialMentions: []string{"engineering"}, }, }, - "matching upper case group with preceeding @": { + "matching upper case group with preceding @": { Message: "@Engineering", Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}}, Expected: &ExplicitMentions{ @@ -2092,12 +2092,12 @@ func TestAddGroupMention(t *testing.T) { Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}}, Expected: false, }, - "matching group with preceeding @": { + "matching group with preceding @": { Word: "@engineering", Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}}, Expected: true, }, - "matching upper case group with preceeding @": { + "matching upper case group with preceding @": { Word: "@Engineering", Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}}, Expected: true, diff --git a/config/feature_flags.go b/config/feature_flags.go index 235a95eb6a..3b62728011 100644 --- a/config/feature_flags.go +++ b/config/feature_flags.go @@ -56,7 +56,7 @@ func NewFeatureFlagSynchronizer(params FeatureFlagSyncParams) (*FeatureFlagSynch // ensureReady blocks until the syncronizer is ready to update feature flag values func (f *FeatureFlagSynchronizer) EnsureReady() error { if err := f.client.BlockUntilReady(10); err != nil { - return errors.Wrap(err, "split.io client could not initalize") + return errors.Wrap(err, "split.io client could not initialize") } return nil diff --git a/config/store.go b/config/store.go index 775ec8d2e0..a3638d8c6b 100644 --- a/config/store.go +++ b/config/store.go @@ -167,7 +167,7 @@ func (s *Store) Set(newCfg *model.Config) (*model.Config, error) { // Don't persist feature flags unless we are on MM cloud // MM cloud uses config in the DB as a cache of the feature flag - // settings in case the managment system is down when a pod starts. + // settings in case the management system is down when a pod starts. if !s.persistFeatureFlags { newCfg.FeatureFlags = nil } diff --git a/model/command_autocomplete.go b/model/command_autocomplete.go index 68d91b2345..f115ed24fe 100644 --- a/model/command_autocomplete.go +++ b/model/command_autocomplete.go @@ -52,7 +52,7 @@ type AutocompleteArg struct { HelpText string // Type of the argument Type AutocompleteArgType - // Required determins if argument is optional or not. + // Required determines if argument is optional or not. Required bool // Actual data of the argument (depends on the Type) Data interface{} diff --git a/model/command_autocomplete_test.go b/model/command_autocomplete_test.go index 5ab81ae928..564fbb0b2e 100644 --- a/model/command_autocomplete_test.go +++ b/model/command_autocomplete_test.go @@ -11,7 +11,7 @@ import ( ) func TestAutocompleteData(t *testing.T) { - ad := NewAutocompleteData("jira", "", "Avaliable commands:") + ad := NewAutocompleteData("jira", "", "Available commands:") assert.Nil(t, ad.IsValid()) ad.RoleID = "some_id" assert.NotNil(t, ad.IsValid()) @@ -75,7 +75,7 @@ func TestAutocompleteDataJSON(t *testing.T) { } func getAutocompleteData() *AutocompleteData { - ad := NewAutocompleteData("jira", "", "Avaliable commands:") + ad := NewAutocompleteData("jira", "", "Available commands:") ad.RoleID = SYSTEM_USER_ROLE_ID command := NewAutocompleteData("connect", "", "Connect to mattermost") command.RoleID = SYSTEM_ADMIN_ROLE_ID diff --git a/model/feature_flags.go b/model/feature_flags.go index e260c877be..eee5c7dbac 100644 --- a/model/feature_flags.go +++ b/model/feature_flags.go @@ -7,7 +7,7 @@ type FeatureFlags struct { // Exists only for unit and manual testing. // When set to a value, will be returned by the ping endpoint. TestFeature string - // Exists only for testing bool functionality. Boolean feature flags interprate "on" or "true" as true and + // Exists only for testing bool functionality. Boolean feature flags interpret "on" or "true" as true and // all other values as false. TestBoolFeature bool diff --git a/model/role.go b/model/role.go index 271e295be6..cbfcf92037 100644 --- a/model/role.go +++ b/model/role.go @@ -278,7 +278,7 @@ func (r *Role) MergeChannelHigherScopedPermissions(higherScopedPermissions *Role _, presentOnHigherScope := higherScopedPermissionsMap[cp.Id] - // For the channel admin role always look to the higher scope to determine if the role has ther permission. + // For the channel admin role always look to the higher scope to determine if the role has their permission. // The channel admin is a special case because they're not part of the UI to be "channel moderated", only // channel members and channel guests are. if higherScopedPermissions.RoleID == CHANNEL_ADMIN_ROLE_ID && presentOnHigherScope { diff --git a/model/search_params_test.go b/model/search_params_test.go index d8bf5296b4..0000dad900 100644 --- a/model/search_params_test.go +++ b/model/search_params_test.go @@ -1207,7 +1207,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is two words seperated with : and should result in a single InChannel", + Name: "input is two words separated with : and should result in a single InChannel", Input: "in:channel", Output: []*SearchParams{ { @@ -1222,7 +1222,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is two words seperated with :, prefied with - and should result in a single ExcludedChannel", + Name: "input is two words separated with :, prefied with - and should result in a single ExcludedChannel", Input: "-in:channel", Output: []*SearchParams{ { @@ -1237,7 +1237,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is two words seperated with : with a prefixed word should result in a single InChannel and a term", + Name: "input is two words separated with : with a prefixed word should result in a single InChannel and a term", Input: "testing in:channel", Output: []*SearchParams{ { @@ -1252,7 +1252,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is two words seperated with : with a prefixed word should result in a single ExcludedChannel and a term", + Name: "input is two words separated with : with a prefixed word should result in a single ExcludedChannel and a term", Input: "testing -in:channel", Output: []*SearchParams{ { @@ -1267,7 +1267,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is two words seperated with : with a postfix word should result in a single InChannel and a term", + Name: "input is two words separated with : with a postfix word should result in a single InChannel and a term", Input: "in:channel testing", Output: []*SearchParams{ { @@ -1282,7 +1282,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is four words seperated with : should result in a two InChannels", + Name: "input is four words separated with : should result in a two InChannels", Input: "in:channel in:otherchannel", Output: []*SearchParams{ { @@ -1297,7 +1297,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is four words seperated with : prefixed with a word should result in two InChannels and one term", + Name: "input is four words separated with : prefixed with a word should result in two InChannels and one term", Input: "testing in:channel in:otherchannel", Output: []*SearchParams{ { @@ -1312,7 +1312,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is four words seperated with : prefixed with a word should result in one InChannel, one FromUser and one term", + Name: "input is four words separated with : prefixed with a word should result in one InChannel, one FromUser and one term", Input: "testing in:channel from:someone", Output: []*SearchParams{ { @@ -1327,7 +1327,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is four words seperated with : prefixed with a word should result in one InChannel, one ExcludedUser and one term", + Name: "input is four words separated with : prefixed with a word should result in one InChannel, one ExcludedUser and one term", Input: "testing in:channel -from:someone", Output: []*SearchParams{ { @@ -1342,7 +1342,7 @@ func TestParseSearchParams(t *testing.T) { }, }, { - Name: "input is six words seperated with : prefixed with a word should result in one InChannel, one FromUser, one ExcludedUser and one term", + Name: "input is six words separated with : prefixed with a word should result in one InChannel, one FromUser, one ExcludedUser and one term", Input: "testing in:channel from:someone -from:someoneelse", Output: []*SearchParams{ { diff --git a/services/searchengine/bleveengine/indexer/indexing_job.go b/services/searchengine/bleveengine/indexer/indexing_job.go index 1397f18e68..9dba645cff 100644 --- a/services/searchengine/bleveengine/indexer/indexing_job.go +++ b/services/searchengine/bleveengine/indexer/indexing_job.go @@ -117,7 +117,7 @@ func (worker *BleveIndexerWorker) Stop() { func (worker *BleveIndexerWorker) DoJob(job *model.Job) { claimed, err := worker.jobServer.ClaimJob(job) if err != nil { - mlog.Warn("Worker: Error ocurred while trying to claim job", mlog.String("workername", worker.name), mlog.String("job_id", job.Id), mlog.Err(err)) + mlog.Warn("Worker: Error occurred while trying to claim job", mlog.String("workername", worker.name), mlog.String("job_id", job.Id), mlog.Err(err)) return } if !claimed { diff --git a/store/errors.go b/store/errors.go index c5e36194ff..6e44d741aa 100644 --- a/store/errors.go +++ b/store/errors.go @@ -7,7 +7,7 @@ import ( "fmt" ) -// ErrInvalidInput indicates an error that has occured due to an invalid input. +// ErrInvalidInput indicates an error that has occurred due to an invalid input. type ErrInvalidInput struct { Entity string // The entity which was sent as the input. Field string // The field of the entity which was invalid. @@ -26,7 +26,7 @@ func (e *ErrInvalidInput) Error() string { return fmt.Sprintf("invalid input: entity: %s field: %s value: %s", e.Entity, e.Field, e.Value) } -// ErrLimitExceeded indicates an error that has occured because some value exceeded a limit. +// ErrLimitExceeded indicates an error that has occurred because some value exceeded a limit. type ErrLimitExceeded struct { What string // What was the object that exceeded. Count int // The value of the object. @@ -45,7 +45,7 @@ func (e *ErrLimitExceeded) Error() string { return fmt.Sprintf("limit exceeded: what: %s count: %d metadata: %s", e.What, e.Count, e.meta) } -// ErrConflict indicates a conflict that occured. +// ErrConflict indicates a conflict that occurred. type ErrConflict struct { Resource string // The resource which created the conflict. err error // Internal error. diff --git a/store/sqlstore/channel_store_categories.go b/store/sqlstore/channel_store_categories.go index 82cb4168df..2f29d1b5a2 100644 --- a/store/sqlstore/channel_store_categories.go +++ b/store/sqlstore/channel_store_categories.go @@ -361,7 +361,7 @@ func (s SqlChannelStore) completePopulatingCategoryChannels(category *model.Side return result, nil } -func (s SqlChannelStore) completePopulatingCategoryChannelsT(transation *gorp.Transaction, category *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { +func (s SqlChannelStore) completePopulatingCategoryChannelsT(transaction *gorp.Transaction, category *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { if category.Type == model.SidebarCategoryCustom || category.Type == model.SidebarCategoryFavorites { return category, nil } @@ -406,7 +406,7 @@ func (s SqlChannelStore) completePopulatingCategoryChannelsT(transation *gorp.Tr return nil, errors.Wrap(err, "channel_tosql") } - if _, err = transation.Select(&channels, sql, args...); err != nil { + if _, err = transaction.Select(&channels, sql, args...); err != nil { return nil, store.NewErrNotFound("ChannelMembers", "") } diff --git a/store/sqlstore/post_store_test.go b/store/sqlstore/post_store_test.go index bea8bfe518..3facace247 100644 --- a/store/sqlstore/post_store_test.go +++ b/store/sqlstore/post_store_test.go @@ -32,7 +32,7 @@ func TestMysqlStopWords(t *testing.T) { Expected: []string{"my car", "so real", "test this-and-that awesome"}, }, { - Name: "Should not remove part of a word containg stop words", + Name: "Should not remove part of a word containing stop words", Args: []string{"whereabouts", "wherein", "tothis", "thisorthat", "waswhen", "whowas", "inthe", "whowill", "thewww"}, Expected: []string{"whereabouts", "wherein", "tothis", "thisorthat", "waswhen", "whowas", "inthe", "whowill", "thewww"}, }, @@ -42,7 +42,7 @@ func TestMysqlStopWords(t *testing.T) { Empty: true, }, { - Name: "Should not remove part of a word containg stop words separated by hyphens", + Name: "Should not remove part of a word containing stop words separated by hyphens", Args: []string{"where-about", "where-in", "to-this", "this-or-that", "was-when", "who-was", "in-the", "who-will", "the-www"}, Expected: []string{"where-about", "where-in", "to-this", "this-or-that", "was-when", "who-was", "in-the", "who-will", "the-www"}, }, diff --git a/store/storetest/group_store.go b/store/storetest/group_store.go index 9e984fac76..85c144d78e 100644 --- a/store/storetest/group_store.go +++ b/store/storetest/group_store.go @@ -749,7 +749,7 @@ func testGroupGetMemberUsersInTeam(t *testing.T, ss store.Store) { require.Nil(t, err) // returns no members when team does not exist - groupMembers, err := ss.Group().GetMemberUsersInTeam(group.Id, "non-existant-channel-id") + groupMembers, err := ss.Group().GetMemberUsersInTeam(group.Id, "non-existent-channel-id") require.Nil(t, err) require.Equal(t, 0, len(groupMembers)) @@ -845,7 +845,7 @@ func testGroupGetMemberUsersNotInChannel(t *testing.T, ss store.Store) { require.Nil(t, nErr) // returns no members when channel does not exist - groupMembers, err := ss.Group().GetMemberUsersNotInChannel(group.Id, "non-existant-channel-id") + groupMembers, err := ss.Group().GetMemberUsersNotInChannel(group.Id, "non-existent-channel-id") require.Nil(t, err) require.Equal(t, 0, len(groupMembers))