1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-30 08:57:07 +02:00
revive/lint/rule.go
subham sarkar 577441d60c
format sources w/ gofumpt (#643)
Signed-off-by: subham sarkar <sarkar.subhams2@gmail.com>
2022-03-02 08:24:55 +01:00

32 lines
655 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
}
// AbstractRule defines an abstract rule.
type AbstractRule struct {
Failures []Failure
}
// ToFailurePosition returns the failure position.
func ToFailurePosition(start, end token.Pos, file *File) FailurePosition {
return FailurePosition{
Start: file.ToPosition(start),
End: file.ToPosition(end),
}
}