Skip to content

Commit

Permalink
fix: Various typos and word ordering in validator messages. (#27)
Browse files Browse the repository at this point in the history
* fix: Various typos and word ordering in validator messages.

* chore: Add a changelog entry.
  • Loading branch information
rudo-thomas authored Jun 29, 2022
1 parent 79592d6 commit bc3ca0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- [#27](https://github.com/FUSAKLA/promruval/pull/27)
- typos and wording in validator messages were corrected

## [v2.3.0] - 2022-06-07

- [#25](https://github.com/FUSAKLA/promruval/pull/25)
Expand Down
8 changes: 4 additions & 4 deletions pkg/validator/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ type expressionDoesNotUseRangeShorterThan struct {
}

func (h expressionDoesNotUseRangeShorterThan) String() string {
return fmt.Sprintf("expr does not use range selctor shorter than `%s`", h.limit)
return fmt.Sprintf("expr does not use range selector shorter than `%s`", h.limit)
}

func (h expressionDoesNotUseRangeShorterThan) Validate(rule rulefmt.Rule, _ *prometheus.Client) []error {
Expand Down Expand Up @@ -279,10 +279,10 @@ type expressionCanBeEvaluated struct {
func (h expressionCanBeEvaluated) String() string {
msg := "expression can be successfully evaluated on the live Prometheus instance"
if h.timeSeriesLimit > 0 {
msg += fmt.Sprintf(" and number of time series it the result is not higher than %d", h.timeSeriesLimit)
msg += fmt.Sprintf(" and the number of time series in the result is not higher than %d", h.timeSeriesLimit)
}
if h.evaluationDurationLimit != 0 {
msg += fmt.Sprintf(" and the evaluation is no loger than %s ", h.evaluationDurationLimit)
msg += fmt.Sprintf(" and the evaluation is not longer than %s", h.evaluationDurationLimit)
}
return msg
}
Expand All @@ -298,7 +298,7 @@ func (h expressionCanBeEvaluated) Validate(rule rulefmt.Rule, prometheusClient *
return append(errs, err)
}
if h.timeSeriesLimit != 0 && count > h.timeSeriesLimit {
errs = append(errs, fmt.Errorf("query returned %d series exceeding the %d limit", count, h.timeSeriesLimit))
errs = append(errs, fmt.Errorf("query returned %d series exceeding the limit %d", count, h.timeSeriesLimit))
}
if h.evaluationDurationLimit != 0 && duration > h.evaluationDurationLimit {
errs = append(errs, fmt.Errorf("query took %s which exceeds the configured maximum %s", duration, h.evaluationDurationLimit))
Expand Down
6 changes: 3 additions & 3 deletions pkg/validator/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func newLabelMatchesRegexp(paramsConfig yaml.Node) (Validator, error) {
return nil, err
}
if params.Label == "" {
return nil, fmt.Errorf("missing lanel name")
return nil, fmt.Errorf("missing label name")
}
expr, err := regexp.Compile(params.Regexp)
if err != nil {
Expand Down Expand Up @@ -284,7 +284,7 @@ func (h exclusiveLabels) String() string {
if h.label1Value != "" {
text += fmt.Sprintf("with value `%s` ", h.label1Value)
}
text += fmt.Sprintf(", it cannot has a label `%s`", h.label2)
text += fmt.Sprintf(", it cannot have label `%s`", h.label2)
if h.label2Value != "" {
text += fmt.Sprintf("with value `%s` ", h.label2Value)
}
Expand All @@ -304,7 +304,7 @@ func (h exclusiveLabels) Validate(rule rulefmt.Rule, _ *prometheus.Client) []err
if !hasLabel2 {
return []error{}
}
errMsg += fmt.Sprintf(", it cannot has label `%s`", h.label2)
errMsg += fmt.Sprintf(", it cannot have label `%s`", h.label2)
if h.label2Value == "" {
return []error{fmt.Errorf(errMsg)}
}
Expand Down

0 comments on commit bc3ca0b

Please sign in to comment.