You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
666 B
32 lines
666 B
5 years ago
|
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 interaface
|
||
|
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 token.Pos, end token.Pos, file *File) FailurePosition {
|
||
|
return FailurePosition{
|
||
|
Start: file.ToPosition(start),
|
||
|
End: file.ToPosition(end),
|
||
|
}
|
||
|
}
|