Skip to content

Commit de563a5

Browse files
committed
refactor: move globals
1 parent b85e067 commit de563a5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmd/readmevalidation/coderresources.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ import (
1717
var (
1818
supportedResourceTypes = []string{"modules", "templates"}
1919
operatingSystems = []string{"windows", "macos", "linux"}
20+
gfmAlertTypes = []string{"NOTE", "IMPORTANT", "CAUTION", "WARNING", "TIP"}
2021

2122
// TODO: This is a holdover from the validation logic used by the Coder Modules repo. It gives us some assurance, but
2223
// realistically, we probably want to parse any Terraform code snippets, and make some deeper guarantees about how it's
2324
// structured. Just validating whether it *can* be parsed as Terraform would be a big improvement.
2425
terraformVersionRe = regexp.MustCompile(`^\s*\bversion\s+=`)
26+
27+
// Matches the format "> [!INFO]". Deliberately using a broad pattern to catch formatting issues that can mess up
28+
// the renderer for the Registry website
29+
gfmAlertRegex = regexp.MustCompile(`^>(\s*)\[!(\w+)\](\s*)(.*)`)
2530
)
2631

2732
type coderResourceFrontmatter struct {
@@ -279,11 +284,6 @@ func aggregateCoderResourceReadmeFiles(resourceType string) ([]readme, error) {
279284
return allReadmeFiles, nil
280285
}
281286

282-
// Matches the format "> [!INFO]". Deliberately using a broad pattern to catch
283-
// formatting issues that can mess up the renderer for the Registry website
284-
var gfmAlertRegex = regexp.MustCompile(`^>(\s*)\[!(\w+)\](\s*)(.*)`)
285-
var gfmAlertTypes = []string{"NOTE", "IMPORTANT", "CAUTION", "WARNING", "TIP"}
286-
287287
func validateResourceGfmAlerts(readmeBody string) []error {
288288
trimmed := strings.TrimSpace(readmeBody)
289289
if trimmed == "" {

0 commit comments

Comments
 (0)