Skip to content

Commit

Permalink
hcldec: Fix MinItems/MaxItems diagnostics messages
Browse files Browse the repository at this point in the history
These were not previously consistent with the usual style.
  • Loading branch information
apparentlymart committed Oct 3, 2017
1 parent cc215b6 commit 2892561
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hcldec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,15 @@ func (s *BlockListSpec) decode(content *hcl.BodyContent, block *hcl.Block, ctx *
if len(elems) < s.MinItems {
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("insufficient %s blocks", s.TypeName),
Detail: fmt.Sprintf("at least %d blocks are required", s.MinItems),
Summary: fmt.Sprintf("Insufficient %s blocks", s.TypeName),
Detail: fmt.Sprintf("At least %d %q blocks are required.", s.MinItems, s.TypeName),
Subject: &content.MissingItemRange,
})
} else if s.MaxItems > 0 && len(elems) > s.MaxItems {
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("too many %s blocks", s.TypeName),
Detail: fmt.Sprintf("no more than %d blocks are allowed", s.MaxItems),
Summary: fmt.Sprintf("Too many %s blocks", s.TypeName),
Detail: fmt.Sprintf("No more than %d %q blocks are allowed", s.MaxItems, s.TypeName),
Subject: &sourceRanges[s.MaxItems],
})
}
Expand Down

0 comments on commit 2892561

Please sign in to comment.