revive: add rule name in message. (#1772)

This commit is contained in:
Ludovic Fernandez 2021-02-24 09:07:54 +01:00 committed by GitHub
parent 42ff682f7f
commit b407bb8fd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -109,7 +109,7 @@ func NewRevive(cfg *config.ReviveSettings) *goanalysis.Linter {
for i := range results { for i := range results {
issues = append(issues, goanalysis.NewIssue(&result.Issue{ issues = append(issues, goanalysis.NewIssue(&result.Issue{
Severity: string(results[i].Severity), Severity: string(results[i].Severity),
Text: fmt.Sprintf("%q", results[i].Failure.Failure), Text: fmt.Sprintf("%s: %s", results[i].RuleName, results[i].Failure.Failure),
Pos: token.Position{ Pos: token.Position{
Filename: results[i].Position.Start.Filename, Filename: results[i].Position.Start.Filename,
Line: results[i].Position.Start.Line, Line: results[i].Position.Start.Line,

View File

@ -7,7 +7,7 @@ import "time"
func testRevive(t *time.Duration) error { func testRevive(t *time.Duration) error {
if t == nil { if t == nil {
return nil return nil
} else { // ERROR "if block ends with a return statement, so drop this else and outdent its block" } else { // ERROR "indent-error-flow: if block ends with a return statement, .*"
return nil return nil
} }
} }