From 5116420e9ad8b6e1480d2bb9f28d4319c8a6037b Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Wed, 29 Apr 2020 21:37:21 +0200 Subject: [PATCH] Fix misspell issues (#23905) * Fix misspell issues See, $ golangci-lint run --timeout 10m --disable-all -E misspell ./... Signed-off-by: Mario Trangoni * Fix codespell issues See, $ codespell -S './.git*' -L 'uint,thru,pres,unknwon,serie,referer,uptodate,durationm' Signed-off-by: Mario Trangoni * ci please? * non-empty commit - ci? * Trigger build Co-authored-by: bergquist Co-authored-by: Kyle Brandt --- pkg/api/ldap_debug.go | 4 ++-- pkg/api/pluginproxy/ds_proxy_test.go | 2 +- .../datamigrations/encrypt_datasource_passwords.go | 2 +- pkg/cmd/grafana-server/diagnostics.go | 2 +- pkg/infra/remotecache/remotecache.go | 2 +- pkg/login/social/generic_oauth.go | 2 +- pkg/models/user.go | 2 +- pkg/services/alerting/alerting_usage_test.go | 4 ++-- pkg/services/alerting/conditions/evaluator.go | 2 +- pkg/services/alerting/engine.go | 6 +++--- pkg/services/alerting/notifiers/base.go | 2 +- pkg/services/alerting/notifiers/threema.go | 2 +- pkg/services/ldap/ldap.go | 2 +- pkg/services/notifications/email.go | 4 ++-- .../correct-properties/correct-properties.yaml | 4 ++-- pkg/services/sqlstore/apikey_test.go | 7 ++++--- pkg/services/sqlstore/sqlstore.go | 2 +- pkg/services/sqlstore/user_test.go | 2 +- pkg/setting/setting.go | 2 +- pkg/tsdb/azuremonitor/time-grain.go | 2 +- pkg/tsdb/cloudwatch/response_parser_test.go | 2 +- pkg/tsdb/stackdriver/stackdriver_test.go | 4 ++-- pkg/util/proxyutil/proxyutil_test.go | 2 +- 23 files changed, 33 insertions(+), 32 deletions(-) diff --git a/pkg/api/ldap_debug.go b/pkg/api/ldap_debug.go index e78bfafd664..3ab43074784 100644 --- a/pkg/api/ldap_debug.go +++ b/pkg/api/ldap_debug.go @@ -109,7 +109,7 @@ func (server *HTTPServer) ReloadLDAPCfg() Response { return Success("LDAP config reloaded") } -// GetLDAPStatus attempts to connect to all the configured LDAP servers and returns information on whenever they're availabe or not. +// GetLDAPStatus attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not. func (server *HTTPServer) GetLDAPStatus(c *models.ReqContext) Response { if !ldap.IsEnabled() { return Error(http.StatusBadRequest, "LDAP is not enabled", nil) @@ -224,7 +224,7 @@ func (server *HTTPServer) PostSyncUserWithLDAP(c *models.ReqContext) Response { err = bus.Dispatch(upsertCmd) if err != nil { - return Error(http.StatusInternalServerError, "Failed to udpate the user", err) + return Error(http.StatusInternalServerError, "Failed to update the user", err) } return Success("User synced successfully") diff --git a/pkg/api/pluginproxy/ds_proxy_test.go b/pkg/api/pluginproxy/ds_proxy_test.go index c5be905cbcf..4d5698cc433 100644 --- a/pkg/api/pluginproxy/ds_proxy_test.go +++ b/pkg/api/pluginproxy/ds_proxy_test.go @@ -377,7 +377,7 @@ func TestDSRouteRule(t *testing.T) { }) }) - Convey("When proxying a datasource that has oauth token pass-thru enabled", func() { + Convey("When proxying a datasource that has oauth token pass-through enabled", func() { social.SocialMap["generic_oauth"] = &social.SocialGenericOAuth{ SocialBase: &social.SocialBase{ Config: &oauth2.Config{}, diff --git a/pkg/cmd/grafana-cli/commands/datamigrations/encrypt_datasource_passwords.go b/pkg/cmd/grafana-cli/commands/datamigrations/encrypt_datasource_passwords.go index 26418714a0d..1f390565f46 100644 --- a/pkg/cmd/grafana-cli/commands/datamigrations/encrypt_datasource_passwords.go +++ b/pkg/cmd/grafana-cli/commands/datamigrations/encrypt_datasource_passwords.go @@ -49,7 +49,7 @@ func EncryptDatasourcePaswords(c utils.CommandLine, sqlStore *sqlstore.SqlStore) } if passwordsUpdated == 0 && basicAuthUpdated == 0 { - logger.Infof("%s All datasources secrets are allready encrypted\n", color.GreenString("✔")) + logger.Infof("%s All datasources secrets are already encrypted\n", color.GreenString("✔")) } logger.Info("\n") diff --git a/pkg/cmd/grafana-server/diagnostics.go b/pkg/cmd/grafana-server/diagnostics.go index 776a05b42a6..cdb223ec47c 100644 --- a/pkg/cmd/grafana-server/diagnostics.go +++ b/pkg/cmd/grafana-server/diagnostics.go @@ -39,7 +39,7 @@ func (pd *profilingDiagnostics) overrideWithEnv() error { if portEnv != "" { port, parseErr := strconv.ParseUint(portEnv, 0, 64) if parseErr != nil { - return fmt.Errorf("Failed to parse %s enviroment variable to unsigned integer", profilingPortEnvName) + return fmt.Errorf("Failed to parse %s environment variable to unsigned integer", profilingPortEnvName) } pd.port = uint(port) } diff --git a/pkg/infra/remotecache/remotecache.go b/pkg/infra/remotecache/remotecache.go index 3ac3d06fa1f..aba062205a4 100644 --- a/pkg/infra/remotecache/remotecache.go +++ b/pkg/infra/remotecache/remotecache.go @@ -29,7 +29,7 @@ func init() { // CacheStorage allows the caller to set, get and delete items in the cache. // Cached items are stored as byte arrays and marshalled using "encoding/gob" -// so any struct added to the cache needs to be registred with `remotecache.Register` +// so any struct added to the cache needs to be registered with `remotecache.Register` // ex `remotecache.Register(CacheableStruct{})`` type CacheStorage interface { // Get reads object from Cache diff --git a/pkg/login/social/generic_oauth.go b/pkg/login/social/generic_oauth.go index 7a91000fb59..04f8e4a6b0d 100644 --- a/pkg/login/social/generic_oauth.go +++ b/pkg/login/social/generic_oauth.go @@ -289,7 +289,7 @@ func (s *SocialGenericOAuth) FetchPrivateEmail(client *http.Client) (string, err err = json.Unmarshal(response.Body, &data) if err != nil { s.log.Error("Error decoding email addresses response", "raw_json", string(response.Body), "error", err) - return "", errutil.Wrap("Erro decoding email addresses response", err) + return "", errutil.Wrap("Error decoding email addresses response", err) } records = data.Values diff --git a/pkg/models/user.go b/pkg/models/user.go index 7ecdba21137..24904a70899 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -259,7 +259,7 @@ func (auth *AuthModuleConversion) FromDB(data []byte) error { return nil } -// Just a stub, we don't wanna write to database +// Just a stub, we don't want to write to database func (auth *AuthModuleConversion) ToDB() ([]byte, error) { return []byte{}, nil } diff --git a/pkg/services/alerting/alerting_usage_test.go b/pkg/services/alerting/alerting_usage_test.go index 6f7f76b3087..4ca7fc4d12c 100644 --- a/pkg/services/alerting/alerting_usage_test.go +++ b/pkg/services/alerting/alerting_usage_test.go @@ -64,7 +64,7 @@ func TestAlertingUsageStats(t *testing.T) { for k := range expected { if expected[k] != result.DatasourceUsage[k] { - t.Errorf("result missmatch for %s. got %v expected %v", k, result.DatasourceUsage[k], expected[k]) + t.Errorf("result mismatch for %s. got %v expected %v", k, result.DatasourceUsage[k], expected[k]) } } } @@ -118,7 +118,7 @@ func TestParsingAlertRuleSettings(t *testing.T) { tc.shouldErr(t, err) diff := cmp.Diff(tc.expected, result) if diff != "" { - t.Errorf("result missmatch (-want +got) %s\n", diff) + t.Errorf("result mismatch (-want +got) %s\n", diff) } }) } diff --git a/pkg/services/alerting/conditions/evaluator.go b/pkg/services/alerting/conditions/evaluator.go index 8c2883425a0..b0dd44bf6a1 100644 --- a/pkg/services/alerting/conditions/evaluator.go +++ b/pkg/services/alerting/conditions/evaluator.go @@ -140,7 +140,7 @@ func inSlice(a string, list []string) bool { return false } -// HumanThresholdType converts a treshold "type" string to a string that matches the UI +// HumanThresholdType converts a threshold "type" string to a string that matches the UI // so errors are less confusing. func HumanThresholdType(typ string) string { switch typ { diff --git a/pkg/services/alerting/engine.go b/pkg/services/alerting/engine.go index 79271b4487c..5be21b2aed8 100644 --- a/pkg/services/alerting/engine.go +++ b/pkg/services/alerting/engine.go @@ -44,7 +44,7 @@ func (e *AlertEngine) IsDisabled() bool { return !setting.AlertingEnabled || !setting.ExecuteAlerts } -// Init initalizes the AlertingService. +// Init initializes the AlertingService. func (e *AlertEngine) Init() error { e.ticker = NewTicker(time.Now(), time.Second*0, clock.New()) e.execQueue = make(chan *Job, 1000) @@ -209,8 +209,8 @@ func (e *AlertEngine) processJob(attemptID int, attemptChan chan int, cancelChan // override the context used for evaluation with a new context for notifications. // This makes it possible for notifiers to execute when datasources - // dont respond within the timeout limit. We should rewrite this so notifications - // dont reuse the evalContext and get its own context. + // don't respond within the timeout limit. We should rewrite this so notifications + // don't reuse the evalContext and get its own context. evalContext.Ctx = resultHandleCtx evalContext.Rule.State = evalContext.GetNewState() if err := e.resultHandler.handle(evalContext); err != nil { diff --git a/pkg/services/alerting/notifiers/base.go b/pkg/services/alerting/notifiers/base.go index 7c0afa56750..df569931a58 100644 --- a/pkg/services/alerting/notifiers/base.go +++ b/pkg/services/alerting/notifiers/base.go @@ -141,7 +141,7 @@ func (n *NotifierBase) GetDisableResolveMessage() bool { return n.DisableResolveMessage } -// GetFrequency returns the freqency for how often +// GetFrequency returns the frequency for how often // alerts should be evaluated. func (n *NotifierBase) GetFrequency() time.Duration { return n.Frequency diff --git a/pkg/services/alerting/notifiers/threema.go b/pkg/services/alerting/notifiers/threema.go index 425bc896922..12e722d68d8 100644 --- a/pkg/services/alerting/notifiers/threema.go +++ b/pkg/services/alerting/notifiers/threema.go @@ -78,7 +78,7 @@ type ThreemaNotifier struct { log log.Logger } -// NewThreemaNotifier is the constructor for the Threema notifer +// NewThreemaNotifier is the constructor for the Threema notifier func NewThreemaNotifier(model *models.AlertNotification) (alerting.Notifier, error) { if model.Settings == nil { return nil, alerting.ValidationError{Reason: "No Settings Supplied"} diff --git a/pkg/services/ldap/ldap.go b/pkg/services/ldap/ldap.go index 515ed752aa8..a8e7015e9ab 100644 --- a/pkg/services/ldap/ldap.go +++ b/pkg/services/ldap/ldap.go @@ -157,7 +157,7 @@ func (server *Server) Close() { // 2. Single bind // // If all the users meant to be used with Grafana have the ability to search in LDAP server // then we bind with LDAP server with targeted login/password -// and then search for the said user in order to retrive all the information about them +// and then search for the said user in order to retrieve all the information about them // 3. Unauthenticated bind // For some LDAP configurations it is allowed to search the // user without login/password binding with LDAP server, in such case diff --git a/pkg/services/notifications/email.go b/pkg/services/notifications/email.go index ed4ec93abb3..ff273073a30 100644 --- a/pkg/services/notifications/email.go +++ b/pkg/services/notifications/email.go @@ -5,13 +5,13 @@ import ( "github.com/grafana/grafana/pkg/setting" ) -// AttachedFile is struct representating email attached files +// AttachedFile struct represents email attached files. type AttachedFile struct { Name string Content []byte } -// Message is representation of the email message +// Message is representation of the email message. type Message struct { To []string SingleEmail bool diff --git a/pkg/services/provisioning/notifiers/testdata/test-configs/correct-properties/correct-properties.yaml b/pkg/services/provisioning/notifiers/testdata/test-configs/correct-properties/correct-properties.yaml index 5c71e022933..c4ad80b8275 100644 --- a/pkg/services/provisioning/notifiers/testdata/test-configs/correct-properties/correct-properties.yaml +++ b/pkg/services/provisioning/notifiers/testdata/test-configs/correct-properties/correct-properties.yaml @@ -14,7 +14,7 @@ notifiers: - name: another-not-default-notification type: email settings: - addresses: example@exmaple.com + addresses: example@example.com org_id: 3 uid: "notifier2" is_default: false @@ -29,7 +29,7 @@ notifiers: org_id: 3 uid: "notifier4" settings: - addresses: example@exmaple.com + addresses: example@example.com delete_notifiers: - name: default-slack-notification org_id: 2 diff --git a/pkg/services/sqlstore/apikey_test.go b/pkg/services/sqlstore/apikey_test.go index 1d04c3cd98a..0461c5b63a4 100644 --- a/pkg/services/sqlstore/apikey_test.go +++ b/pkg/services/sqlstore/apikey_test.go @@ -1,10 +1,11 @@ package sqlstore import ( - "github.com/grafana/grafana/pkg/models" - "github.com/stretchr/testify/assert" "testing" "time" + + "github.com/grafana/grafana/pkg/models" + "github.com/stretchr/testify/assert" ) func TestApiKeyDataAccess(t *testing.T) { @@ -54,7 +55,7 @@ func TestApiKeyDataAccess(t *testing.T) { assert.True(t, *query.Result.Expires >= timeNow().Unix()) // timeNow() has been called twice since creation; once by AddApiKey and once by GetApiKeyByName - // therefore two seconds should be subtracted by next value retuned by timeNow() + // therefore two seconds should be subtracted by next value returned by timeNow() // that equals the number by which timeSeed has been advanced then := timeNow().Add(-2 * time.Second) expected := then.Add(1 * time.Hour).UTC().Unix() diff --git a/pkg/services/sqlstore/sqlstore.go b/pkg/services/sqlstore/sqlstore.go index 23a0b9e3b81..52b40267cff 100644 --- a/pkg/services/sqlstore/sqlstore.go +++ b/pkg/services/sqlstore/sqlstore.go @@ -308,7 +308,7 @@ type ITestDB interface { Fatalf(format string, args ...interface{}) } -// InitTestDB initiliaze test DB +// InitTestDB initialize test DB. func InitTestDB(t ITestDB) *SqlStore { t.Helper() sqlstore := &SqlStore{} diff --git a/pkg/services/sqlstore/user_test.go b/pkg/services/sqlstore/user_test.go index 514fdbb6818..451f721d972 100644 --- a/pkg/services/sqlstore/user_test.go +++ b/pkg/services/sqlstore/user_test.go @@ -322,7 +322,7 @@ func TestUserDataAccess(t *testing.T) { }) }) - Convey("when retreiving signed in user for orgId=0 result should return active org id", func() { + Convey("when retrieving signed in user for orgId=0 result should return active org id", func() { ss.CacheService.Flush() query := &models.GetSignedInUserQuery{OrgId: users[1].OrgId, UserId: users[1].Id} diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index c7838457ef7..f4183a84e30 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -47,7 +47,7 @@ var ( ) // This constant corresponds to the default value for ldap_sync_ttl in .ini files -// it is used for comparision and has to be kept in sync +// it is used for comparison and has to be kept in sync const ( AUTH_PROXY_SYNC_TTL = 60 ) diff --git a/pkg/tsdb/azuremonitor/time-grain.go b/pkg/tsdb/azuremonitor/time-grain.go index 425e39b6208..7321192113a 100644 --- a/pkg/tsdb/azuremonitor/time-grain.go +++ b/pkg/tsdb/azuremonitor/time-grain.go @@ -9,7 +9,7 @@ import ( "github.com/grafana/grafana/pkg/tsdb" ) -// TimeGrain handles convertions between +// TimeGrain handles conversions between // the ISO 8601 Duration format (PT1H), Kbn units (1h) and Time Grains (1 hour) // Also handles using the automatic Grafana interval to calculate a ISO 8601 Duration. type TimeGrain struct{} diff --git a/pkg/tsdb/cloudwatch/response_parser_test.go b/pkg/tsdb/cloudwatch/response_parser_test.go index f6e42aaabca..c50b872c568 100644 --- a/pkg/tsdb/cloudwatch/response_parser_test.go +++ b/pkg/tsdb/cloudwatch/response_parser_test.go @@ -189,7 +189,7 @@ func TestCloudWatchResponseParser(t *testing.T) { So((*series)[1].Name, ShouldEqual, "lb4 Expanded") }) - Convey("can expand dimension value when no values are returned and a multi-valued template variabel is used", func() { + Convey("can expand dimension value when no values are returned and a multi-valued template variable is used", func() { timestamp := time.Unix(0, 0) resp := map[string]*cloudwatch.MetricDataResult{ "lb3": { diff --git a/pkg/tsdb/stackdriver/stackdriver_test.go b/pkg/tsdb/stackdriver/stackdriver_test.go index c03f49eaf02..a5780380b6e 100644 --- a/pkg/tsdb/stackdriver/stackdriver_test.go +++ b/pkg/tsdb/stackdriver/stackdriver_test.go @@ -619,7 +619,7 @@ func TestStackdriver(t *testing.T) { Convey("when interpolating filter wildcards", func() { Convey("and wildcard is used in the beginning and the end of the word", func() { - Convey("and theres no wildcard in the middle of the word", func() { + Convey("and there's no wildcard in the middle of the word", func() { value := interpolateFilterWildcards("*-central1*") So(value, ShouldEqual, `has_substring("-central1")`) }) @@ -680,7 +680,7 @@ func TestStackdriver(t *testing.T) { }) Convey("when building filter string", func() { - Convey("and theres no regex operator", func() { + Convey("and there's no regex operator", func() { Convey("and there are wildcards in a filter value", func() { filterParts := []string{"zone", "=", "*-central1*"} value := buildFilterString("somemetrictype", filterParts) diff --git a/pkg/util/proxyutil/proxyutil_test.go b/pkg/util/proxyutil/proxyutil_test.go index ebf3fffcd53..47664527a22 100644 --- a/pkg/util/proxyutil/proxyutil_test.go +++ b/pkg/util/proxyutil/proxyutil_test.go @@ -31,7 +31,7 @@ func TestPrepareProxyRequest(t *testing.T) { require.Equal(t, "127.0.0.1", req.Header.Get("X-Forwarded-For")) }) - t.Run("Prepare proxy request should appent client ip at the end of X-Forwarded-For", func(t *testing.T) { + t.Run("Prepare proxy request should append client ip at the end of X-Forwarded-For", func(t *testing.T) { req, err := http.NewRequest(http.MethodGet, "/", nil) req.RemoteAddr = "127.0.0.1:1234" req.Header.Add("X-Forwarded-For", "192.168.0.1")