Fix misspellings and enable misspell on ci (#16285)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
John Tzikas
2020-12-01 17:27:05 +02:00
коммит произвёл GitHub
родитель c2036f614e
Коммит 3fdc6cb531
20 изменённых файлов: 42 добавлений и 37 удалений

Просмотреть файл

@@ -26,6 +26,7 @@ linters:
- unconvert - unconvert
- unused - unused
- varcheck - varcheck
- misspell
# TODO: enable this later # TODO: enable this later
# - errcheck # - errcheck
@@ -50,3 +51,7 @@ issues:
# ignore golint error for a lot of packages for now # ignore golint error for a lot of packages for now
- golint - 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" 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"

Просмотреть файл

@@ -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() scheme := th.SetupTeamScheme()
team.SchemeId = &scheme.Id team.SchemeId = &scheme.Id
_, err := th.App.UpdateTeamScheme(team) _, err := th.App.UpdateTeamScheme(team)

Просмотреть файл

@@ -199,7 +199,7 @@ func TestDownloadJob(t *testing.T) {
_, resp = th.Client.DownloadJob(job.Id) _, resp = th.Client.DownloadJob(job.Id)
CheckForbiddenStatus(t, resp) 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) _, resp = th.SystemAdminClient.DownloadJob(job.Id)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)

Просмотреть файл

@@ -228,7 +228,7 @@ type AppIface interface {
// belong to users in the specified team, linking them to their users // belong to users in the specified team, linking them to their users
MentionsToTeamMembers(message, teamId string) model.UserMentionMap MentionsToTeamMembers(message, teamId string) model.UserMentionMap
// MoveChannel method is prone to data races if someone joins to channel during the move process. However this // 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 MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError
// NewWebConn returns a new WebConn instance. // NewWebConn returns a new WebConn instance.
NewWebConn(ws *websocket.Conn, session model.Session, t goi18n.TranslateFunc, locale string) *WebConn NewWebConn(ws *websocket.Conn, session model.Session, t goi18n.TranslateFunc, locale string) *WebConn

Просмотреть файл

@@ -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 // 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 { 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. // Check that all channel members are in the destination team.
channelMembers, err := a.GetChannelMembersPage(channel.Id, 0, 10000000) channelMembers, err := a.GetChannelMembersPage(channel.Id, 0, 10000000)

Просмотреть файл

@@ -223,7 +223,7 @@ func (s *Server) GetSanitizedClientLicense() map[string]string {
return sanitizedLicense 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 { func (s *Server) RequestTrialLicense(trialRequest *model.TrialLicenseRequest) *model.AppError {
resp, err := http.Post(requestTrialURL, "application/json", bytes.NewBuffer([]byte(trialRequest.ToJson()))) resp, err := http.Post(requestTrialURL, "application/json", bytes.NewBuffer([]byte(trialRequest.ToJson())))
if err != nil { if err != nil {

Просмотреть файл

@@ -1252,7 +1252,7 @@ func TestSendAckToPushProxy(t *testing.T) {
assert.Equal(t, ack.NotificationType, handler.notificationAcks()[0].NotificationType) 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. // of notifications and verifies they have been properly sent.
func TestAllPushNotifications(t *testing.T) { func TestAllPushNotifications(t *testing.T) {
if testing.Short() { if testing.Short() {

Просмотреть файл

@@ -847,7 +847,7 @@ func TestGetExplicitMentions(t *testing.T) {
OtherPotentialMentions: nil, OtherPotentialMentions: nil,
}, },
}, },
"matching group with preceeding @": { "matching group with preceding @": {
Message: "@engineering", Message: "@engineering",
Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}}, Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}},
Expected: &ExplicitMentions{ Expected: &ExplicitMentions{
@@ -858,7 +858,7 @@ func TestGetExplicitMentions(t *testing.T) {
OtherPotentialMentions: []string{"engineering"}, OtherPotentialMentions: []string{"engineering"},
}, },
}, },
"matching upper case group with preceeding @": { "matching upper case group with preceding @": {
Message: "@Engineering", Message: "@Engineering",
Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}}, Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}},
Expected: &ExplicitMentions{ 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")}}, Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}},
Expected: false, Expected: false,
}, },
"matching group with preceeding @": { "matching group with preceding @": {
Word: "@engineering", Word: "@engineering",
Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}}, Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}},
Expected: true, Expected: true,
}, },
"matching upper case group with preceeding @": { "matching upper case group with preceding @": {
Word: "@Engineering", Word: "@Engineering",
Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}}, Groups: map[string]*model.Group{"engineering": {Name: model.NewString("engineering")}, "developers": {Name: model.NewString("developers")}},
Expected: true, Expected: true,

Просмотреть файл

@@ -56,7 +56,7 @@ func NewFeatureFlagSynchronizer(params FeatureFlagSyncParams) (*FeatureFlagSynch
// ensureReady blocks until the syncronizer is ready to update feature flag values // ensureReady blocks until the syncronizer is ready to update feature flag values
func (f *FeatureFlagSynchronizer) EnsureReady() error { func (f *FeatureFlagSynchronizer) EnsureReady() error {
if err := f.client.BlockUntilReady(10); err != nil { 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 return nil

Просмотреть файл

@@ -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 // 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 // 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 { if !s.persistFeatureFlags {
newCfg.FeatureFlags = nil newCfg.FeatureFlags = nil
} }

Просмотреть файл

@@ -52,7 +52,7 @@ type AutocompleteArg struct {
HelpText string HelpText string
// Type of the argument // Type of the argument
Type AutocompleteArgType Type AutocompleteArgType
// Required determins if argument is optional or not. // Required determines if argument is optional or not.
Required bool Required bool
// Actual data of the argument (depends on the Type) // Actual data of the argument (depends on the Type)
Data interface{} Data interface{}

Просмотреть файл

@@ -11,7 +11,7 @@ import (
) )
func TestAutocompleteData(t *testing.T) { func TestAutocompleteData(t *testing.T) {
ad := NewAutocompleteData("jira", "", "Avaliable commands:") ad := NewAutocompleteData("jira", "", "Available commands:")
assert.Nil(t, ad.IsValid()) assert.Nil(t, ad.IsValid())
ad.RoleID = "some_id" ad.RoleID = "some_id"
assert.NotNil(t, ad.IsValid()) assert.NotNil(t, ad.IsValid())
@@ -75,7 +75,7 @@ func TestAutocompleteDataJSON(t *testing.T) {
} }
func getAutocompleteData() *AutocompleteData { func getAutocompleteData() *AutocompleteData {
ad := NewAutocompleteData("jira", "", "Avaliable commands:") ad := NewAutocompleteData("jira", "", "Available commands:")
ad.RoleID = SYSTEM_USER_ROLE_ID ad.RoleID = SYSTEM_USER_ROLE_ID
command := NewAutocompleteData("connect", "", "Connect to mattermost") command := NewAutocompleteData("connect", "", "Connect to mattermost")
command.RoleID = SYSTEM_ADMIN_ROLE_ID command.RoleID = SYSTEM_ADMIN_ROLE_ID

Просмотреть файл

@@ -7,7 +7,7 @@ type FeatureFlags struct {
// Exists only for unit and manual testing. // Exists only for unit and manual testing.
// When set to a value, will be returned by the ping endpoint. // When set to a value, will be returned by the ping endpoint.
TestFeature string 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. // all other values as false.
TestBoolFeature bool TestBoolFeature bool

Просмотреть файл

@@ -278,7 +278,7 @@ func (r *Role) MergeChannelHigherScopedPermissions(higherScopedPermissions *Role
_, presentOnHigherScope := higherScopedPermissionsMap[cp.Id] _, 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 // 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. // channel members and channel guests are.
if higherScopedPermissions.RoleID == CHANNEL_ADMIN_ROLE_ID && presentOnHigherScope { if higherScopedPermissions.RoleID == CHANNEL_ADMIN_ROLE_ID && presentOnHigherScope {

Просмотреть файл

@@ -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", Input: "in:channel",
Output: []*SearchParams{ 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", Input: "-in:channel",
Output: []*SearchParams{ 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", Input: "testing in:channel",
Output: []*SearchParams{ 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", Input: "testing -in:channel",
Output: []*SearchParams{ 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", Input: "in:channel testing",
Output: []*SearchParams{ 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", Input: "in:channel in:otherchannel",
Output: []*SearchParams{ 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", Input: "testing in:channel in:otherchannel",
Output: []*SearchParams{ 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", Input: "testing in:channel from:someone",
Output: []*SearchParams{ 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", Input: "testing in:channel -from:someone",
Output: []*SearchParams{ 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", Input: "testing in:channel from:someone -from:someoneelse",
Output: []*SearchParams{ Output: []*SearchParams{
{ {

Просмотреть файл

@@ -117,7 +117,7 @@ func (worker *BleveIndexerWorker) Stop() {
func (worker *BleveIndexerWorker) DoJob(job *model.Job) { func (worker *BleveIndexerWorker) DoJob(job *model.Job) {
claimed, err := worker.jobServer.ClaimJob(job) claimed, err := worker.jobServer.ClaimJob(job)
if err != nil { 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 return
} }
if !claimed { if !claimed {

Просмотреть файл

@@ -7,7 +7,7 @@ import (
"fmt" "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 { type ErrInvalidInput struct {
Entity string // The entity which was sent as the input. Entity string // The entity which was sent as the input.
Field string // The field of the entity which was invalid. 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) 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 { type ErrLimitExceeded struct {
What string // What was the object that exceeded. What string // What was the object that exceeded.
Count int // The value of the object. 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) 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 { type ErrConflict struct {
Resource string // The resource which created the conflict. Resource string // The resource which created the conflict.
err error // Internal error. err error // Internal error.

Просмотреть файл

@@ -361,7 +361,7 @@ func (s SqlChannelStore) completePopulatingCategoryChannels(category *model.Side
return result, nil 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 { if category.Type == model.SidebarCategoryCustom || category.Type == model.SidebarCategoryFavorites {
return category, nil return category, nil
} }
@@ -406,7 +406,7 @@ func (s SqlChannelStore) completePopulatingCategoryChannelsT(transation *gorp.Tr
return nil, errors.Wrap(err, "channel_tosql") 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", "<too many fields>") return nil, store.NewErrNotFound("ChannelMembers", "<too many fields>")
} }

Просмотреть файл

@@ -32,7 +32,7 @@ func TestMysqlStopWords(t *testing.T) {
Expected: []string{"my car", "so real", "test this-and-that awesome"}, 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"}, Args: []string{"whereabouts", "wherein", "tothis", "thisorthat", "waswhen", "whowas", "inthe", "whowill", "thewww"},
Expected: []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, 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"}, 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"}, Expected: []string{"where-about", "where-in", "to-this", "this-or-that", "was-when", "who-was", "in-the", "who-will", "the-www"},
}, },

Просмотреть файл

@@ -749,7 +749,7 @@ func testGroupGetMemberUsersInTeam(t *testing.T, ss store.Store) {
require.Nil(t, err) require.Nil(t, err)
// returns no members when team does not exist // 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.Nil(t, err)
require.Equal(t, 0, len(groupMembers)) require.Equal(t, 0, len(groupMembers))
@@ -845,7 +845,7 @@ func testGroupGetMemberUsersNotInChannel(t *testing.T, ss store.Store) {
require.Nil(t, nErr) require.Nil(t, nErr)
// returns no members when channel does not exist // 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.Nil(t, err)
require.Equal(t, 0, len(groupMembers)) require.Equal(t, 0, len(groupMembers))