mirror of
https://github.com/mgechev/revive.git
synced 2025-07-01 00:24:54 +02:00
* refactor: avoid running rule once configuration failed * refactor: remove deep-exit in lint/linter.go
32 lines
697 B
Go
32 lines
697 B
Go
package lint
|
|
|
|
import (
|
|
"go/token"
|
|
)
|
|
|
|
// DisabledInterval contains a single disabled interval and the associated rule name.
|
|
type DisabledInterval struct {
|
|
From token.Position
|
|
To token.Position
|
|
RuleName string
|
|
}
|
|
|
|
// Rule defines an abstract rule interface
|
|
type Rule interface {
|
|
Name() string
|
|
Apply(*File, Arguments) []Failure
|
|
}
|
|
|
|
// ConfigurableRule defines an abstract configurable rule interface.
|
|
type ConfigurableRule interface {
|
|
Configure(Arguments) error
|
|
}
|
|
|
|
// ToFailurePosition returns the failure position.
|
|
func ToFailurePosition(start, end token.Pos, file *File) FailurePosition {
|
|
return FailurePosition{
|
|
Start: file.ToPosition(start),
|
|
End: file.ToPosition(end),
|
|
}
|
|
}
|