Fix misspellings and enable misspell on ci (#16285)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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{
|
||||
{
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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", "<too many fields>")
|
||||
}
|
||||
|
||||
|
||||
@@ -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"},
|
||||
},
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user