influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.5k stars 5.55k forks source link

testifylint->negative-positive - Should we enable it? #15536

Closed zak-pawel closed 2 months ago

zak-pawel commented 3 months ago

Description

This issue starts a discussion about enabling:

Example

Before:

assert.Less(t, a, 0)
assert.Greater(t, 0, a)
assert.True(t, a < 0)
assert.True(t, 0 > a)
assert.False(t, a >= 0)
assert.False(t, 0 <= a)

assert.Greater(t, a, 0)
assert.Less(t, 0, a)
assert.True(t, a > 0)
assert.True(t, 0 < a)
assert.False(t, a <= 0)
assert.False(t, 0 >= a)

After:

assert.Negative(t, a)
assert.Positive(t, a)

Expected output

Decision about enabling or not enabling this checker.

Findings

For this checker, the following findings were found in the current codebase:

plugins/inputs/pgbouncer/pgbouncer_test.go:101:2                          testifylint  negative-positive: use require.Positive
plugins/inputs/pgbouncer/pgbouncer_test.go:213:2                          testifylint  negative-positive: use require.Positive
plugins/inputs/postgresql/postgresql_test.go:128:2                        testifylint  negative-positive: use require.Positive
plugins/inputs/postgresql_extensible/postgresql_extensible_test.go:124:2  testifylint  negative-positive: use require.Positive

Additional configuration

For this checker, no additional configuration can be provided.

srebhan commented 2 months ago

Fine with me.

powersj commented 2 months ago

+1