github.com/yoheimuta/protolint@v0.49.8-0.20240515023657-4ecaebb7575d/internal/linter/config/customizableSeverityOption.go (about)

     1  package config
     2  
     3  import "github.com/yoheimuta/protolint/linter/rule"
     4  
     5  // CustomizableSeverityOption represents an option where the
     6  // severity of a rule can be configured via yaml.
     7  type CustomizableSeverityOption struct {
     8  	severity *rule.Severity `yaml:"severity" toml:"severity"`
     9  }
    10  
    11  // Severity returns the configured severity. If no severity
    12  // is set, the default severity will be ERROR
    13  func (c CustomizableSeverityOption) Severity() rule.Severity {
    14  	if c.severity == nil {
    15  		return rule.SeverityError
    16  	}
    17  
    18  	return *c.severity
    19  }