Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Jun 5, 2024
1 parent d5c8d71 commit 3848c80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/database/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ func (c *Client) createAlertChunk(machineID string, owner *ent.Machine, alerts [

if len(metaItem.Value) > 4095 {
c.Log.Warningf("truncated meta %s : value too long", metaItem.Key)

Check warning on line 557 in pkg/database/alerts.go

View check run for this annotation

Codecov / codecov/patch

pkg/database/alerts.go#L557

Added line #L557 was not covered by tests
value = value[:4095]
}

Expand Down
12 changes: 10 additions & 2 deletions pkg/models/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
const (
// these are duplicated from pkg/types
// TODO XXX: de-duplicate
Ip = "Ip"
Range = "Range"
Ip = "Ip"
Range = "Range"
CscliImportOrigin = "cscli-import"
)

Expand All @@ -27,13 +27,15 @@ func (a *Alert) GetScenario() string {
if a.Scenario == nil {
return ""
}

return *a.Scenario
}

func (a *Alert) GetEventsCount() int32 {
if a.EventsCount == nil {
return 0
}

return *a.EventsCount
}

Expand All @@ -43,6 +45,7 @@ func (e *Event) GetMeta(key string) string {
return meta.Value
}
}

return ""
}

Expand All @@ -52,20 +55,23 @@ func (a *Alert) GetMeta(key string) string {
return meta.Value
}
}

return ""
}

func (s Source) GetValue() string {
if s.Value == nil {
return ""
}

return *s.Value
}

func (s Source) GetScope() string {
if s.Scope == nil {
return ""
}

return *s.Scope
}

Expand All @@ -74,9 +80,11 @@ func (s Source) GetAsNumberName() string {
if s.AsNumber != "0" {
ret += s.AsNumber
}

if s.AsName != "" {
ret += " " + s.AsName
}

return ret
}

Expand Down

0 comments on commit 3848c80

Please sign in to comment.