mirror of
https://github.com/mgechev/revive.git
synced 2024-11-28 08:49:11 +02:00
55cfae63e9
* adds support for comments when enabling/disabling * adds config flag to require disabling reason * Update lint/file.go adds code fmt suggestion by @mgechev Co-Authored-By: Minko Gechev <mgechev@gmail.com> * moves regexp compilation out of the function fix typo in condition * adds support for comments when enabling/disabling * skips incomplete directives and generate a failure * adds _directive_ concept to cope with specify-disable-reason * adds doc gofmt * fixes severity is ignored
14 lines
422 B
Go
14 lines
422 B
Go
package formatter
|
|
|
|
import "github.com/mgechev/revive/lint"
|
|
|
|
func severity(config lint.Config, failure lint.Failure) lint.Severity {
|
|
if config, ok := config.Rules[failure.RuleName]; ok && config.Severity == lint.SeverityError {
|
|
return lint.SeverityError
|
|
}
|
|
if config, ok := config.Directives[failure.RuleName]; ok && config.Severity == lint.SeverityError {
|
|
return lint.SeverityError
|
|
}
|
|
return lint.SeverityWarning
|
|
}
|