Chore/fix lint issues (#27704)
* Chore: Fix linting issues Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -103,7 +103,7 @@ func (dn *DiscordNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
|
||||
embed := simplejson.New()
|
||||
embed.Set("title", evalContext.GetNotificationTitle())
|
||||
//Discord takes integer for color
|
||||
// Discord takes integer for color
|
||||
embed.Set("color", color)
|
||||
embed.Set("url", ruleURL)
|
||||
embed.Set("description", evalContext.Rule.Message)
|
||||
|
||||
@@ -121,7 +121,7 @@ func (hc *HipChatNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
}
|
||||
|
||||
message := ""
|
||||
if evalContext.Rule.State != models.AlertStateOK { //don't 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
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func (hc *HipChatNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
message = evalContext.GetNotificationTitle() + " in state " + evalContext.GetStateModel().Text
|
||||
}
|
||||
|
||||
//HipChat has a set list of colors
|
||||
// HipChat has a set list of colors
|
||||
var color string
|
||||
switch evalContext.Rule.State {
|
||||
case models.AlertStateOK:
|
||||
|
||||
@@ -83,7 +83,7 @@ func (kn *KafkaNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
records := make([]interface{}, 1)
|
||||
|
||||
bodyJSON := simplejson.New()
|
||||
//get alert state in the kafka output issue #11401
|
||||
// get alert state in the kafka output issue #11401
|
||||
bodyJSON.Set("alert_state", state)
|
||||
bodyJSON.Set("description", evalContext.Rule.Name+" - "+evalContext.Rule.Message)
|
||||
bodyJSON.Set("client", "Grafana")
|
||||
|
||||
@@ -68,7 +68,7 @@ func TestOpsGenieNotifier(t *testing.T) {
|
||||
Settings: settingsJSON,
|
||||
}
|
||||
|
||||
notifier, notifierErr := NewOpsGenieNotifier(model) //unhandled error
|
||||
notifier, notifierErr := NewOpsGenieNotifier(model) // unhandled error
|
||||
|
||||
opsgenieNotifier := notifier.(*OpsGenieNotifier)
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ func (sn *SensuNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
bodyJSON := simplejson.New()
|
||||
bodyJSON.Set("ruleId", evalContext.Rule.ID)
|
||||
// Sensu alerts cannot have spaces in them
|
||||
bodyJSON.Set("name", strings.Replace(evalContext.Rule.Name, " ", "_", -1))
|
||||
bodyJSON.Set("name", strings.ReplaceAll(evalContext.Rule.Name, " ", "_"))
|
||||
// Sensu alerts require a source. We set it to the user-specified value (optional),
|
||||
// else we fallback and use the grafana ruleID.
|
||||
if sn.Source != "" {
|
||||
|
||||
@@ -241,7 +241,7 @@ func (sn *SlackNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
}
|
||||
}
|
||||
msg := ""
|
||||
if evalContext.Rule.State != models.AlertStateOK { //don't 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.
|
||||
msg = evalContext.Rule.Message
|
||||
}
|
||||
imageURL := ""
|
||||
@@ -287,7 +287,7 @@ func (sn *SlackNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
body["blocks"] = blocks
|
||||
}
|
||||
|
||||
//recipient override
|
||||
// recipient override
|
||||
if sn.Recipient != "" {
|
||||
body["channel"] = sn.Recipient
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func (tn *TeamsNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
}
|
||||
|
||||
message := ""
|
||||
if evalContext.Rule.State != models.AlertStateOK { //don't 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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user