mirror of
https://github.com/prymitive/karma
synced 2026-02-13 20:59:53 +00:00
fix(ci): enable revive linter
This commit is contained in:
committed by
Łukasz Mierzwa
parent
f1daa332fa
commit
19d7a29551
@@ -8,7 +8,7 @@ level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=https://127.0.0.1:9093
|
||||
level=info msg="Reading silence ACL config file" path=acl.yaml
|
||||
level=error msg="Execution failed" error="failed to parse silence ACL configuration file \"acl.yaml\": yaml: unmarshal errors:\n line 1: cannot unmarshal !!str `This Is...` into config.silencesACLSchema"
|
||||
level=error msg="Execution failed" error="failed to parse silence ACL configuration file \"acl.yaml\": yaml: unmarshal errors:\n line 1: cannot unmarshal !!str `This Is...` into config.SilencesACLSchema"
|
||||
-- karma.yaml --
|
||||
authentication:
|
||||
header:
|
||||
|
||||
@@ -113,7 +113,7 @@ func DedupAlerts() []models.AlertGroup {
|
||||
return dedupedGroups
|
||||
}
|
||||
|
||||
// DedupKnownLabels returns a deduplicated slice of all known label names
|
||||
// DedupSilences returns a deduplicated slice of all known silences
|
||||
func DedupSilences() []models.ManagedSilence {
|
||||
silenceByCluster := map[string]map[string]models.Silence{}
|
||||
upstreams := GetAlertmanagers()
|
||||
|
||||
@@ -30,7 +30,7 @@ type alertmanagerMetrics struct {
|
||||
Errors map[string]float64
|
||||
}
|
||||
|
||||
type healthCheck struct {
|
||||
type HealthCheck struct {
|
||||
filters []filters.FilterT
|
||||
wasFound bool
|
||||
}
|
||||
@@ -68,7 +68,7 @@ type Alertmanager struct {
|
||||
HTTPHeaders map[string]string
|
||||
// CORS credentials
|
||||
CORSCredentials string `json:"corsCredentials"`
|
||||
healthchecks map[string]healthCheck
|
||||
healthchecks map[string]HealthCheck
|
||||
healthchecksVisible bool
|
||||
}
|
||||
|
||||
@@ -204,10 +204,10 @@ func (am *Alertmanager) pullAlerts(version string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
healthchecks := map[string]healthCheck{}
|
||||
healthchecks := map[string]HealthCheck{}
|
||||
am.lock.RLock()
|
||||
for name, hc := range am.healthchecks {
|
||||
healthchecks[name] = healthCheck{
|
||||
healthchecks[name] = HealthCheck{
|
||||
filters: hc.filters,
|
||||
wasFound: false,
|
||||
}
|
||||
@@ -258,7 +258,7 @@ func (am *Alertmanager) pullAlerts(version string) error {
|
||||
}
|
||||
|
||||
if name, hc := am.IsHealthCheckAlert(&alert); hc != nil {
|
||||
healthchecks[name] = healthCheck{
|
||||
healthchecks[name] = HealthCheck{
|
||||
filters: hc.filters,
|
||||
wasFound: true,
|
||||
}
|
||||
@@ -599,7 +599,7 @@ func (am *Alertmanager) IsHealthy() bool {
|
||||
return lastError == ""
|
||||
}
|
||||
|
||||
func (am *Alertmanager) IsHealthCheckAlert(alert *models.Alert) (string, *healthCheck) {
|
||||
func (am *Alertmanager) IsHealthCheckAlert(alert *models.Alert) (string, *HealthCheck) {
|
||||
for name, hc := range am.healthchecks {
|
||||
hc := hc
|
||||
positiveMatch := false
|
||||
|
||||
@@ -44,7 +44,7 @@ func NewAlertmanager(cluster, name, upstreamURI string, opts ...Option) (*Alertm
|
||||
},
|
||||
},
|
||||
status: models.AlertmanagerStatus{},
|
||||
healthchecks: map[string]healthCheck{},
|
||||
healthchecks: map[string]HealthCheck{},
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
@@ -176,9 +176,9 @@ func WithCORSCredentials(val string) Option {
|
||||
|
||||
func WithHealthchecks(val map[string][]string) Option {
|
||||
return func(am *Alertmanager) error {
|
||||
healthchecks := map[string]healthCheck{}
|
||||
healthchecks := map[string]HealthCheck{}
|
||||
for name, filterExpressions := range val {
|
||||
hc := healthCheck{
|
||||
hc := HealthCheck{
|
||||
filters: []filters.FilterT{},
|
||||
}
|
||||
for _, filterExpression := range filterExpressions {
|
||||
|
||||
@@ -42,12 +42,12 @@ type SilenceACLRule struct {
|
||||
Matchers SilenceACLMatchersConfig
|
||||
}
|
||||
|
||||
type silencesACLSchema struct {
|
||||
type SilencesACLSchema struct {
|
||||
Rules []SilenceACLRule
|
||||
}
|
||||
|
||||
func ReadSilenceACLConfig(path string) (*silencesACLSchema, error) {
|
||||
cfg := silencesACLSchema{}
|
||||
func ReadSilenceACLConfig(path string) (*SilencesACLSchema, error) {
|
||||
cfg := SilencesACLSchema{}
|
||||
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
|
||||
@@ -265,12 +265,11 @@ func (config *configSchema) Read(flags *pflag.FlagSet) (string, error) {
|
||||
),
|
||||
ZeroFields: true,
|
||||
}
|
||||
kConf := koanf.UnmarshalConf{
|
||||
err = k.UnmarshalWithConf("", &config, koanf.UnmarshalConf{
|
||||
Tag: "koanf",
|
||||
FlatPaths: false,
|
||||
DecoderConfig: &dConf,
|
||||
}
|
||||
err = k.UnmarshalWithConf("", &config, kConf)
|
||||
})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to unmarshal configuration: %v", err)
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ func (lvsl LabelValueStatsList) Less(i, j int) bool {
|
||||
return lvsl[i].Hits > lvsl[j].Hits
|
||||
}
|
||||
|
||||
// LabelStats is used in the overview modal, it shows top labels across alerts
|
||||
// LabelNameStats is used in the overview modal, it shows top labels across alerts
|
||||
type LabelNameStats struct {
|
||||
Name string `json:"name"`
|
||||
Values LabelValueStatsList `json:"values"`
|
||||
|
||||
@@ -2,7 +2,7 @@ package models
|
||||
|
||||
import "regexp"
|
||||
|
||||
// JiraRule is used to detect JIRA issue IDs in strings and turn those into
|
||||
// LinkDetectRule is used to detect JIRA issue IDs in strings and turn those into
|
||||
// links
|
||||
type LinkDetectRule struct {
|
||||
Regex *regexp.Regexp
|
||||
|
||||
@@ -39,7 +39,7 @@ $(GOBIN)/golangci-lint: tools/golangci-lint/go.mod tools/golangci-lint/go.sum
|
||||
go install -modfile=tools/golangci-lint/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
.PHONY: lint-go
|
||||
lint-go: $(GOBIN)/golangci-lint lint-go-looppointer
|
||||
$(ENV) golangci-lint run -v --timeout 5m -E staticcheck,misspell,promlinter
|
||||
$(ENV) golangci-lint run -v --timeout 5m -E staticcheck,misspell,promlinter,revive
|
||||
|
||||
.PHONY: format-go
|
||||
format-go:
|
||||
|
||||
@@ -4,4 +4,5 @@ import "embed"
|
||||
|
||||
//go:embed build/* src/*
|
||||
|
||||
// StaticFiles exports build and src directorires as embed.FS
|
||||
var StaticFiles embed.FS
|
||||
|
||||
Reference in New Issue
Block a user