mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-02-16 10:37:16 +00:00
Improve linting (#861)
* Disable unused-parameter check due to false positives on Collect() calls. * Enable misspell. * Simplify error returns. Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
parent
6b56e2f057
commit
5f917ccdd9
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
|
- misspell
|
||||||
- revive
|
- revive
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
@ -14,3 +15,9 @@ linters-settings:
|
|||||||
exclude-functions:
|
exclude-functions:
|
||||||
# Never check for logger errors.
|
# Never check for logger errors.
|
||||||
- (github.com/go-kit/log.Logger).Log
|
- (github.com/go-kit/log.Logger).Log
|
||||||
|
revive:
|
||||||
|
rules:
|
||||||
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
|
||||||
|
- name: unused-parameter
|
||||||
|
severity: warning
|
||||||
|
disabled: true
|
||||||
|
@ -115,10 +115,7 @@ func (c PGDatabaseCollector) Update(ctx context.Context, instance *instance, ch
|
|||||||
prometheus.GaugeValue, sizeMetric, datname,
|
prometheus.GaugeValue, sizeMetric, datname,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if err := rows.Err(); err != nil {
|
return rows.Err()
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func sliceContains(slice []string, s string) bool {
|
func sliceContains(slice []string, s string) bool {
|
||||||
|
@ -126,8 +126,5 @@ func (PGReplicationSlotCollector) Update(ctx context.Context, instance *instance
|
|||||||
prometheus.GaugeValue, isActiveValue, slotNameLabel,
|
prometheus.GaugeValue, isActiveValue, slotNameLabel,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if err := rows.Err(); err != nil {
|
return rows.Err()
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
@ -218,8 +218,5 @@ func (PGStatIOUserTablesCollector) Update(ctx context.Context, instance *instanc
|
|||||||
datnameLabel, schemanameLabel, relnameLabel,
|
datnameLabel, schemanameLabel, relnameLabel,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if err := rows.Err(); err != nil {
|
return rows.Err()
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user