Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
m-sandusky committed Feb 21, 2018
1 parent 4c95a3f commit 7c13592
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions rules/validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ func (v *validator) validateMappingRules(mrv map[string]*rules.MappingRuleView)
return err
}
if len(types) == 0 {
return fmt.Errorf(
"mapping rule '%s' does not match any allowed metric types, filter=%s",
view.Name,
view.Filter,
)
return fmt.Errorf("mapping rule '%s' does not match any allowed metric types, filter=%s", view.Name, view.Filter)
}

// Validate that the policies are valid.
Expand Down Expand Up @@ -142,11 +138,7 @@ func (v *validator) validateRollupRules(rrv map[string]*rules.RollupRuleView) er
return err
}
if len(types) == 0 {
return fmt.Errorf(
"rollup rule '%s' does not match any allowed metric types, filter=%s",
view.Name,
view.Filter,
)
return fmt.Errorf("rollup rule '%s' does not match any allowed metric types, filter=%s", view.Name, view.Filter)
}

for _, target := range view.Targets {
Expand All @@ -169,13 +161,7 @@ func (v *validator) validateRollupRules(rrv map[string]*rules.RollupRuleView) er
current := target.RollupTarget()
for _, seenTarget := range targetsSeen {
if current.SameTransform(seenTarget) {
return errors.NewRuleConflictError(
fmt.Sprintf(
"rollup target with name '%s' and tags '%s' already exists",
current.Name,
current.Tags,
),
)
return errors.NewRuleConflictError(fmt.Sprintf("rollup target with name '%s' and tags '%s' already exists", current.Name, current.Tags))
}
}
targetsSeen = append(targetsSeen, current)
Expand All @@ -193,10 +179,7 @@ func (v *validator) validateFilter(ruleName string, f string) (filters.TagFilter
for tag := range filterValues {
// Validating the filter tag name does not contain invalid chars.
if err := v.opts.CheckInvalidCharactersForTagName(tag); err != nil {
return nil, fmt.Errorf(
"rule '%s' has invalid rule filter '%s': tag name '%s' contains invalid character, err: %v",
ruleName, f, tag, err,
)
return nil, fmt.Errorf("rule '%s' has invalid rule filter '%s': tag name '%s' contains invalid character, err: %v", ruleName, f, tag, err)
}
}
return filterValues, nil
Expand Down

0 comments on commit 7c13592

Please sign in to comment.