File tree Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 11package lint
22
3- // Rule Severity Constants
4- const (
5- SeverityWarn = "warn"
6- SeverityError = "error"
7- )
8-
93// Config represent linter config
104type Config struct {
115 Formatter string `yaml:"formatter"`
@@ -15,7 +9,7 @@ type Config struct {
159// RuleConfig represent config for a rule
1610type RuleConfig struct {
1711 Enabled bool `yaml:"enabled"`
18- Severity string `yaml:"severity"`
12+ Severity Severity `yaml:"severity"`
1913 Argument interface {} `yaml:"argument"`
2014
2115 // Optional flags
Original file line number Diff line number Diff line change 1+ package lint
2+
3+ // Rule Severity Constants
4+ const (
5+ SeverityWarn Severity = "warn"
6+ SeverityError Severity = "error"
7+ )
8+
9+ type Severity string
10+
11+ func (s Severity ) String () string {
12+ switch s {
13+ case SeverityError :
14+ return "Error"
15+ case SeverityWarn :
16+ return "Warning"
17+ default :
18+ return "Severity(" + string (s ) + ")"
19+ }
20+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ type Result struct {
1111// RuleResult holds result of a linter rule
1212type RuleResult struct {
1313 Name string
14- Severity string
14+ Severity Severity
1515 Message string
1616}
1717
You can’t perform that action at this time.
0 commit comments