Przeglądaj źródła

pkg: fix codespell issues

Mario Trangoni 7 lat temu
rodzic
commit
91fb2e07ce

+ 1 - 1
pkg/api/metrics.go

@@ -75,7 +75,7 @@ func GetTestDataScenarios(c *m.ReqContext) Response {
 	return JSON(200, &result)
 }
 
-// Genereates a index out of range error
+// Generates a index out of range error
 func GenerateError(c *m.ReqContext) Response {
 	var array []string
 	return JSON(200, array[20])

+ 1 - 1
pkg/api/static/static.go

@@ -48,7 +48,7 @@ type StaticOptions struct {
 	// Expires defines which user-defined function to use for producing a HTTP Expires Header
 	// https://developers.google.com/speed/docs/insights/LeverageBrowserCaching
 	AddHeaders func(ctx *macaron.Context)
-	// FileSystem is the interface for supporting any implmentation of file system.
+	// FileSystem is the interface for supporting any implementation of file system.
 	FileSystem http.FileSystem
 }
 

+ 1 - 1
pkg/components/dashdiffs/formatter_json.go

@@ -22,7 +22,7 @@ const (
 )
 
 var (
-	// changeTypeToSymbol is used for populating the terminating characer in
+	// changeTypeToSymbol is used for populating the terminating character in
 	// the diff
 	changeTypeToSymbol = map[ChangeType]string{
 		ChangeNil:     "",

+ 2 - 2
pkg/components/dynmap/dynmap_test.go

@@ -76,10 +76,10 @@ func TestFirst(t *testing.T) {
 	assert.True(s == "fallback", "must get string return fallback")
 
 	s, err = j.GetString("name")
-	assert.True(s == "anton" && err == nil, "name shoud match")
+	assert.True(s == "anton" && err == nil, "name should match")
 
 	s, err = j.GetString("address", "street")
-	assert.True(s == "Street 42" && err == nil, "street shoud match")
+	assert.True(s == "Street 42" && err == nil, "street should match")
 	//log.Println("s: ", s.String())
 
 	_, err = j.GetNumber("age")

+ 1 - 1
pkg/middleware/recovery.go

@@ -35,7 +35,7 @@ var (
 	slash     = []byte("/")
 )
 
-// stack returns a nicely formated stack frame, skipping skip frames
+// stack returns a nicely formatted stack frame, skipping skip frames
 func stack(skip int) []byte {
 	buf := new(bytes.Buffer) // the returned data
 	// As we loop, we open files and read them. These variables record the currently

+ 1 - 1
pkg/models/dashboards.go

@@ -157,7 +157,7 @@ func NewDashboardFromJson(data *simplejson.Json) *Dashboard {
 	return dash
 }
 
-// GetDashboardModel turns the command into the savable model
+// GetDashboardModel turns the command into the saveable model
 func (cmd *SaveDashboardCommand) GetDashboardModel() *Dashboard {
 	dash := NewDashboardFromJson(cmd.Dashboard)
 	userId := cmd.UserId

+ 1 - 1
pkg/models/folders.go

@@ -32,7 +32,7 @@ type Folder struct {
 	HasAcl    bool
 }
 
-// GetDashboardModel turns the command into the savable model
+// GetDashboardModel turns the command into the saveable model
 func (cmd *CreateFolderCommand) GetDashboardModel(orgId int64, userId int64) *Dashboard {
 	dashFolder := NewDashboardFolder(strings.TrimSpace(cmd.Title))
 	dashFolder.OrgId = orgId

+ 1 - 1
pkg/plugins/plugins_test.go

@@ -12,7 +12,7 @@ import (
 
 func TestPluginScans(t *testing.T) {
 
-	Convey("When scaning for plugins", t, func() {
+	Convey("When scanning for plugins", t, func() {
 		setting.StaticRootPath, _ = filepath.Abs("../../public/")
 		setting.Cfg = ini.Empty()
 		err := initPlugins(context.Background())

+ 1 - 1
pkg/plugins/queries.go

@@ -37,7 +37,7 @@ func GetPluginSettings(orgId int64) (map[string]*m.PluginSettingInfoDTO, error)
 
 		// if it's included in app check app settings
 		if pluginDef.IncludedInAppId != "" {
-			// app componets are by default disabled
+			// app components are by default disabled
 			opt.Enabled = false
 
 			if appSettings, ok := pluginMap[pluginDef.IncludedInAppId]; ok {

+ 4 - 4
pkg/services/alerting/engine_test.go

@@ -10,7 +10,7 @@ import (
 )
 
 type FakeEvalHandler struct {
-	SuccessCallID int // 0 means never sucess
+	SuccessCallID int // 0 means never success
 	CallNb        int
 }
 
@@ -87,7 +87,7 @@ func TestEngineProcessJob(t *testing.T) {
 
 		Convey("Should trigger as many retries as needed", func() {
 
-			Convey("never sucess -> max retries number", func() {
+			Convey("never success -> max retries number", func() {
 				expectedAttempts := alertMaxAttempts
 				evalHandler := NewFakeEvalHandler(0)
 				engine.evalHandler = evalHandler
@@ -96,7 +96,7 @@ func TestEngineProcessJob(t *testing.T) {
 				So(evalHandler.CallNb, ShouldEqual, expectedAttempts)
 			})
 
-			Convey("always sucess -> never retry", func() {
+			Convey("always success -> never retry", func() {
 				expectedAttempts := 1
 				evalHandler := NewFakeEvalHandler(1)
 				engine.evalHandler = evalHandler
@@ -105,7 +105,7 @@ func TestEngineProcessJob(t *testing.T) {
 				So(evalHandler.CallNb, ShouldEqual, expectedAttempts)
 			})
 
-			Convey("some errors before sucess -> some retries", func() {
+			Convey("some errors before success -> some retries", func() {
 				expectedAttempts := int(math.Ceil(float64(alertMaxAttempts) / 2))
 				evalHandler := NewFakeEvalHandler(expectedAttempts)
 				engine.evalHandler = evalHandler

+ 1 - 1
pkg/services/alerting/notifiers/hipchat.go

@@ -111,7 +111,7 @@ func (this *HipChatNotifier) Notify(evalContext *alerting.EvalContext) error {
 	}
 
 	message := ""
-	if evalContext.Rule.State != models.AlertStateOK { //dont add message when going back to alert state ok.
+	if evalContext.Rule.State != models.AlertStateOK { //don't add message when going back to alert state ok.
 		message += " " + evalContext.Rule.Message
 	}
 

+ 1 - 1
pkg/services/alerting/notifiers/slack.go

@@ -129,7 +129,7 @@ func (this *SlackNotifier) Notify(evalContext *alerting.EvalContext) error {
 	}
 
 	message := this.Mention
-	if evalContext.Rule.State != m.AlertStateOK { //dont add message when going back to alert state ok.
+	if evalContext.Rule.State != m.AlertStateOK { //don't add message when going back to alert state ok.
 		message += " " + evalContext.Rule.Message
 	}
 	image_url := ""

+ 2 - 2
pkg/services/alerting/notifiers/teams.go

@@ -13,7 +13,7 @@ func init() {
 	alerting.RegisterNotifier(&alerting.NotifierPlugin{
 		Type:        "teams",
 		Name:        "Microsoft Teams",
-		Description: "Sends notifications using Incomming Webhook connector to Microsoft Teams",
+		Description: "Sends notifications using Incoming Webhook connector to Microsoft Teams",
 		Factory:     NewTeamsNotifier,
 		OptionsTemplate: `
       <h3 class="page-heading">Teams settings</h3>
@@ -76,7 +76,7 @@ func (this *TeamsNotifier) Notify(evalContext *alerting.EvalContext) error {
 	}
 
 	message := this.Mention
-	if evalContext.Rule.State != m.AlertStateOK { //dont add message when going back to alert state ok.
+	if evalContext.Rule.State != m.AlertStateOK { //don't add message when going back to alert state ok.
 		message += " " + evalContext.Rule.Message
 	} else {
 		message += " " // summary must not be empty

+ 1 - 1
pkg/services/alerting/notifiers/telegram_test.go

@@ -100,7 +100,7 @@ func TestTelegramNotifier(t *testing.T) {
 					So(caption, ShouldContainSubstring, "Some kind of message that is too long for appending to our pretty little message, this line is actually exactly 197 chars long and I will get there in the end I promise ")
 				})
 
-				Convey("Metrics should be skipped if they dont fit", func() {
+				Convey("Metrics should be skipped if they don't fit", func() {
 					evalContext := alerting.NewEvalContext(nil, &alerting.Rule{
 						Name:    "This is an alarm",
 						Message: "Some kind of message that is too long for appending to our pretty little message, this line is actually exactly 197 chars long and I will get there in the end I ",

+ 1 - 1
pkg/services/alerting/result_handler.go

@@ -56,7 +56,7 @@ func (handler *DefaultResultHandler) Handle(evalContext *EvalContext) error {
 
 		if err := bus.Dispatch(cmd); err != nil {
 			if err == m.ErrCannotChangeStateOnPausedAlert {
-				handler.log.Error("Cannot change state on alert thats pause", "error", err)
+				handler.log.Error("Cannot change state on alert that's paused", "error", err)
 				return err
 			}
 

+ 3 - 3
pkg/services/alerting/scheduler.go

@@ -58,7 +58,7 @@ func (s *SchedulerImpl) Tick(tickTime time.Time, execQueue chan *Job) {
 
 		if job.OffsetWait && now%job.Offset == 0 {
 			job.OffsetWait = false
-			s.enque(job, execQueue)
+			s.enqueue(job, execQueue)
 			continue
 		}
 
@@ -66,13 +66,13 @@ func (s *SchedulerImpl) Tick(tickTime time.Time, execQueue chan *Job) {
 			if job.Offset > 0 {
 				job.OffsetWait = true
 			} else {
-				s.enque(job, execQueue)
+				s.enqueue(job, execQueue)
 			}
 		}
 	}
 }
 
-func (s *SchedulerImpl) enque(job *Job, execQueue chan *Job) {
+func (s *SchedulerImpl) enqueue(job *Job, execQueue chan *Job) {
 	s.log.Debug("Scheduler: Putting job on to exec queue", "name", job.Rule.Name, "id", job.Rule.Id)
 	execQueue <- job
 }

+ 1 - 1
pkg/services/guardian/guardian.go

@@ -113,7 +113,7 @@ func (g *dashboardGuardianImpl) checkAcl(permission m.PermissionType, acl []*m.D
 		return false, err
 	}
 
-	// evalute team rules
+	// evaluate team rules
 	for _, p := range acl {
 		for _, ug := range teams {
 			if ug.Id == p.TeamId && p.Permission >= permission {

+ 1 - 1
pkg/services/provisioning/dashboards/config_reader.go

@@ -58,7 +58,7 @@ func (cr *configReader) readConfig() ([]*DashboardsAsConfig, error) {
 
 	files, err := ioutil.ReadDir(cr.path)
 	if err != nil {
-		cr.log.Error("cant read dashboard provisioning files from directory", "path", cr.path)
+		cr.log.Error("can't read dashboard provisioning files from directory", "path", cr.path)
 		return dashboards, nil
 	}
 

+ 1 - 1
pkg/services/provisioning/datasources/config_reader.go

@@ -19,7 +19,7 @@ func (cr *configReader) readConfig(path string) ([]*DatasourcesAsConfig, error)
 
 	files, err := ioutil.ReadDir(path)
 	if err != nil {
-		cr.log.Error("cant read datasource provisioning files from directory", "path", path)
+		cr.log.Error("can't read datasource provisioning files from directory", "path", path)
 		return datasources, nil
 	}
 

+ 1 - 1
pkg/services/sqlstore/alert_notification_test.go

@@ -21,7 +21,7 @@ func TestAlertNotificationSQLAccess(t *testing.T) {
 			}
 
 			err := GetAlertNotifications(cmd)
-			fmt.Printf("errror %v", err)
+			fmt.Printf("error %v", err)
 			So(err, ShouldBeNil)
 			So(cmd.Result, ShouldBeNil)
 		})

+ 1 - 1
pkg/tsdb/opentsdb/opentsdb_test.go

@@ -35,7 +35,7 @@ func TestOpenTsdbExecutor(t *testing.T) {
 
 		})
 
-		Convey("Build metric with downsampling diabled", func() {
+		Convey("Build metric with downsampling disabled", func() {
 
 			query := &tsdb.Query{
 				Model: simplejson.New(),

+ 1 - 1
pkg/tsdb/postgres/macros.go

@@ -79,7 +79,7 @@ func (m *PostgresMacroEngine) evaluateMacro(name string, args []string) (string,
 		}
 		return fmt.Sprintf("extract(epoch from %s) as \"time\"", args[0]), nil
 	case "__timeFilter":
-		// dont use to_timestamp in this macro for redshift compatibility #9566
+		// don't use to_timestamp in this macro for redshift compatibility #9566
 		if len(args) == 0 {
 			return "", fmt.Errorf("missing time column argument for macro %v", name)
 		}