Skip to content

Commit

Permalink
Add data source friendly header
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed Jun 30, 2023
1 parent 6970117 commit 0b692e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions check/contents/check_attributes_section.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ func (d *Document) checkAttributesSection() error {
paragraphs := section.Paragraphs
expectedBylineTexts := []string{
"This resource exports the following attributes in addition to the arguments above:",
"This data source exports the following attributes in addition to the arguments above:",
"In addition to all arguments above, the following attributes are exported:",
"No additional attributes are exported.",
}

switch len(paragraphs) {
case 0:
return fmt.Errorf("attribute section byline should be: %q (preferred), %q or %q", expectedBylineTexts[0], expectedBylineTexts[1], expectedBylineTexts[2])
return fmt.Errorf("attribute section byline should be: %q, %q, %q, or %q", expectedBylineTexts[0], expectedBylineTexts[1], expectedBylineTexts[2], expectedBylineTexts[3])
case 1:
paragraphText := string(paragraphs[0].Text(d.source))

if paragraphText != expectedBylineTexts[0] && paragraphText != expectedBylineTexts[1] && paragraphText != expectedBylineTexts[2] {
return fmt.Errorf("attribute section byline (%s) should be: %q (preferred), %q or %q", paragraphText, expectedBylineTexts[0], expectedBylineTexts[1], expectedBylineTexts[2])
if paragraphText != expectedBylineTexts[0] && paragraphText != expectedBylineTexts[1] && paragraphText != expectedBylineTexts[2] && paragraphText != expectedBylineTexts[3] {
return fmt.Errorf("attribute section byline (%s) should be: %q, %q, %q, or %q", paragraphText, expectedBylineTexts[0], expectedBylineTexts[1], expectedBylineTexts[2], expectedBylineTexts[3])
}
}

Expand Down

0 comments on commit 0b692e3

Please sign in to comment.