cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
internal/config/comparison.go
26lines · modecode
| 1 | package config |
| 2 | |
| 3 | import ( |
| 4 | "github.com/cloudflare/pint/internal/checks" |
| 5 | ) |
| 6 | |
| 7 | type ComparisonSettings struct { |
| 8 | Severity string `hcl:"severity,optional"` |
| 9 | } |
| 10 | |
| 11 | func (cs ComparisonSettings) validate() error { |
| 12 | if cs.Severity != "" { |
| 13 | if _, err := checks.ParseSeverity(cs.Severity); err != nil { |
| 14 | return err |
| 15 | } |
| 16 | } |
| 17 | return nil |
| 18 | } |
| 19 | |
| 20 | func (cs ComparisonSettings) getSeverity(fallback checks.Severity) checks.Severity { |
| 21 | if cs.Severity != "" { |
| 22 | sev, _ := checks.ParseSeverity(cs.Severity) |
| 23 | return sev |
| 24 | } |
| 25 | return fallback |
| 26 | } |
| 27 | |