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.

plain.go 620B

1234567891011121314151617181920212223242526
  1. package formatter
  2. import (
  3. "fmt"
  4. "github.com/mgechev/revive/lint"
  5. )
  6. // Plain is an implementation of the Formatter interface
  7. // which formats the errors to JSON.
  8. type Plain struct {
  9. Metadata lint.FormatterMetadata
  10. }
  11. // Name returns the name of the formatter
  12. func (f *Plain) Name() string {
  13. return "plain"
  14. }
  15. // Format formats the failures gotten from the lint.
  16. func (f *Plain) Format(failures <-chan lint.Failure, _ lint.Config) (string, error) {
  17. for failure := range failures {
  18. fmt.Printf("%v: %s %s\n", failure.Position.Start, failure.Failure, "https://revive.run/r#"+failure.RuleName)
  19. }
  20. return "", nil
  21. }