github.com/Johnny2210/revive@v1.0.8-0.20210625134200-febf37ccd0f5/formatter/severity.go (about)

     1  package formatter
     2  
     3  import "github.com/mgechev/revive/lint"
     4  
     5  func severity(config lint.Config, failure lint.Failure) lint.Severity {
     6  	if config, ok := config.Rules[failure.RuleName]; ok && config.Severity == lint.SeverityError {
     7  		return lint.SeverityError
     8  	}
     9  	if config, ok := config.Directives[failure.RuleName]; ok && config.Severity == lint.SeverityError {
    10  		return lint.SeverityError
    11  	}
    12  	return lint.SeverityWarning
    13  }