github.com/yoheimuta/protolint@v0.49.8-0.20240515023657-4ecaebb7575d/internal/addon/rules/base.go (about)

     1  package rules
     2  
     3  import "github.com/yoheimuta/protolint/linter/rule"
     4  
     5  // RuleWithSeverity represents a rule with a configurable severity.
     6  type RuleWithSeverity struct {
     7  	severity rule.Severity
     8  }
     9  
    10  // NewRuleWithSeverity takes a severity and adds it to a new instance
    11  // of RuleWithSeverity
    12  func NewRuleWithSeverity(
    13  	severity rule.Severity,
    14  ) RuleWithSeverity {
    15  	return RuleWithSeverity{severity: severity}
    16  }
    17  
    18  // Severity returns the configured severity.
    19  func (r RuleWithSeverity) Severity() rule.Severity {
    20  	return r.severity
    21  }