revive: add rule name in message. (#1772)
This commit is contained in:
parent
42ff682f7f
commit
b407bb8fd0
@ -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,
|
||||||
|
2
test/testdata/revive.go
vendored
2
test/testdata/revive.go
vendored
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user