mirror of
https://github.com/mgechev/revive.git
synced 2025-01-24 03:47:45 +02:00
unhandled-error: use full function name in error message (#962)
* update tests * Update testdata/unhandled-error-w-ignorelist.go * Update testdata/unhandled-error-w-ignorelist.go --------- Co-authored-by: Denis Voytyuk <5462781+denisvmedia@users.noreply.github.com>
This commit is contained in:
parent
4b62e4b6e5
commit
be35a880ab
@ -119,7 +119,7 @@ func (w *lintUnhandledErrors) addFailure(n *ast.CallExpr) {
|
||||
Category: "bad practice",
|
||||
Confidence: 1,
|
||||
Node: n,
|
||||
Failure: fmt.Sprintf("Unhandled error in call to function %v", gofmt(n.Fun)),
|
||||
Failure: fmt.Sprintf("Unhandled error in call to function %v", name),
|
||||
})
|
||||
}
|
||||
|
||||
|
6
testdata/unhandled-error-w-ignorelist.go
vendored
6
testdata/unhandled-error-w-ignorelist.go
vendored
@ -56,7 +56,7 @@ func testCase4() {
|
||||
b1.Write(nil) // ignore
|
||||
b2.Write(nil) // ignore
|
||||
|
||||
b2.Read([]byte("bytes")) // MATCH /Unhandled error in call to function b2.Read/
|
||||
b2.Read([]byte("bytes")) // MATCH /Unhandled error in call to function bytes.Buffer.Read/
|
||||
}
|
||||
|
||||
type unhandledErrorStruct1 struct {
|
||||
@ -81,9 +81,9 @@ func testCase5() {
|
||||
// fixtures\.unhandledErrorStruct2\.reterr
|
||||
s1 := unhandledErrorStruct1{}
|
||||
_ = s1.reterr()
|
||||
s1.reterr() // MATCH /Unhandled error in call to function s1.reterr/
|
||||
s1.reterr() // MATCH /Unhandled error in call to function fixtures.unhandledErrorStruct1.reterr/
|
||||
|
||||
s2 := unhandledErrorStruct2{}
|
||||
s2.reterr() // ignore
|
||||
s2.reterr1() // MATCH /Unhandled error in call to function s2.reterr1/
|
||||
s2.reterr1() // MATCH /Unhandled error in call to function fixtures.unhandledErrorStruct2.reterr1/
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user