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.

rule.go 666B

12345678910111213141516171819202122232425262728293031
  1. package lint
  2. import (
  3. "go/token"
  4. )
  5. // DisabledInterval contains a single disabled interval and the associated rule name.
  6. type DisabledInterval struct {
  7. From token.Position
  8. To token.Position
  9. RuleName string
  10. }
  11. // Rule defines an abstract rule interaface
  12. type Rule interface {
  13. Name() string
  14. Apply(*File, Arguments) []Failure
  15. }
  16. // AbstractRule defines an abstract rule.
  17. type AbstractRule struct {
  18. Failures []Failure
  19. }
  20. // ToFailurePosition returns the failure position.
  21. func ToFailurePosition(start token.Pos, end token.Pos, file *File) FailurePosition {
  22. return FailurePosition{
  23. Start: file.ToPosition(start),
  24. End: file.ToPosition(end),
  25. }
  26. }