cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.3.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

internal/config/checks.go

36lines · modecode

1package config
2
3import (
4 "fmt"
5
6 "github.com/cloudflare/pint/internal/checks"
7)
8
9type Checks struct {
10 Enabled []string `hcl:"enabled,optional"`
11 Disabled []string `hcl:"disabled,optional"`
12}
13
14func (c Checks) validate() error {
15 for _, name := range c.Enabled {
16 if err := validateCheckName(name); err != nil {
17 return err
18 }
19 }
20 for _, name := range c.Disabled {
21 if err := validateCheckName(name); err != nil {
22 return err
23 }
24 }
25
26 return nil
27}
28
29func validateCheckName(name string) error {
30 for _, c := range checks.CheckNames {
31 if name == c {
32 return nil
33 }
34 }
35 return fmt.Errorf("unknown check name %s", name)
36}
37