2018-01-28 03:01:18 +02:00
|
|
|
package formatter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/mgechev/revive/lint"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Default is an implementation of the Formatter interface
|
2018-10-31 01:07:32 +02:00
|
|
|
// which formats the errors to text.
|
2018-01-28 03:01:18 +02:00
|
|
|
type Default struct {
|
|
|
|
Metadata lint.FormatterMetadata
|
|
|
|
}
|
|
|
|
|
|
|
|
// Name returns the name of the formatter
|
|
|
|
func (f *Default) Name() string {
|
|
|
|
return "default"
|
|
|
|
}
|
|
|
|
|
|
|
|
// Format formats the failures gotten from the lint.
|
2018-09-23 00:27:22 +02:00
|
|
|
func (f *Default) Format(failures <-chan lint.Failure, _ lint.RulesConfig) (string, error) {
|
2018-01-28 03:01:18 +02:00
|
|
|
for failure := range failures {
|
2018-01-28 09:03:07 +02:00
|
|
|
fmt.Printf("%v: %s\n", failure.Position.Start, failure.Failure)
|
2018-01-28 03:01:18 +02:00
|
|
|
}
|
|
|
|
return "", nil
|
|
|
|
}
|