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.

failure.go 782B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package lint
  2. import (
  3. "go/ast"
  4. "go/token"
  5. )
  6. const (
  7. // SeverityWarning declares failures of type warning
  8. SeverityWarning = "warning"
  9. // SeverityError declares failures of type error.
  10. SeverityError = "error"
  11. )
  12. // Severity is the type for the failure types.
  13. type Severity string
  14. // FailurePosition returns the failure position
  15. type FailurePosition struct {
  16. Start token.Position
  17. End token.Position
  18. }
  19. // Failure defines a struct for a linting failure.
  20. type Failure struct {
  21. Failure string
  22. RuleName string
  23. Category string
  24. Position FailurePosition
  25. Node ast.Node `json:"-"`
  26. Confidence float64
  27. // For future use
  28. ReplacementLine string
  29. }
  30. // GetFilename returns the filename.
  31. func (f *Failure) GetFilename() string {
  32. return f.Position.Start.Filename
  33. }