chore: enable thelper and usetesting linters

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
pull/1814/head
Matthieu MOREL 7 days ago committed by GitHub
parent 60463721ef
commit d348a080f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -22,8 +22,10 @@ linters:
- predeclared
- revive
- testifylint
- thelper
- typecheck
- unparam
- usetesting
disable:
- errcheck
- govet
@ -101,3 +103,23 @@ linters-settings:
disabled: true
testifylint:
enable-all: true
thelper:
test:
# Check t.Helper() begins helper function.
# Default: true
begin: false
benchmark:
# Check b.Helper() begins helper function.
# Default: true
begin: false
tb:
# Check tb.Helper() begins helper function.
# Default: true
begin: false
fuzz:
# Check f.Helper() begins helper function.
# Default: true
begin: false
usetesting:
os-create-temp: false
os-mkdir-temp: false

@ -9,9 +9,9 @@ import (
"github.com/shirou/gopsutil/v4/internal/common"
)
func skipIfNotImplementedErr(t testing.TB, err error) {
func skipIfNotImplementedErr(tb testing.TB, err error) {
if errors.Is(err, common.ErrNotImplementedError) {
t.Skip("not implemented")
tb.Skip("not implemented")
}
}
@ -72,15 +72,15 @@ func TestMiscStatString(t *testing.T) {
}
func BenchmarkLoad(b *testing.B) {
loadAvg := func(t testing.TB) {
loadAvg := func(tb testing.TB) {
v, err := Avg()
skipIfNotImplementedErr(t, err)
skipIfNotImplementedErr(tb, err)
if err != nil {
t.Errorf("error %v", err)
tb.Errorf("error %v", err)
}
empty := &AvgStat{}
if v == empty {
t.Errorf("error load: %v", v)
tb.Errorf("error load: %v", v)
}
}

Loading…
Cancel
Save