Skip to content

Commit

Permalink
[chore]: enable compares and negative-positive rules from testifylint (
Browse files Browse the repository at this point in the history
…#6139)

Testifylint is a linter that provides best practices with the use of
testify.

This PR enables
[compares](https://github.com/Antonboom/testifylint?tab=readme-ov-file#compares)
and
[negative-positive](https://github.com/Antonboom/testifylint?tab=readme-ov-file#negative-positive)
rules from [testifylint](https://github.com/Antonboom/testifylint)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
  • Loading branch information
mmorel-35 authored Sep 24, 2024
1 parent c4e8bb3 commit d9fab90
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,8 @@ linters-settings:
testifylint:
enable-all: true
disable:
- compares
- expected-actual
- float-compare
- formatter
- go-require
- negative-positive
- require-error
2 changes: 1 addition & 1 deletion instrumentation/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func assertNonZeroValues(t *testing.T, sm metricdata.ScopeMetrics) {
switch a := m.Data.(type) {
case metricdata.Sum[int64]:
for _, dp := range a.DataPoints {
assert.True(t, dp.Value > 0, fmt.Sprintf("Metric %q should have a non-zero value for point with attributes %+v", m.Name, dp.Attributes))
assert.Positive(t, dp.Value, fmt.Sprintf("Metric %q should have a non-zero value for point with attributes %+v", m.Name, dp.Attributes))
}
default:
t.Fatalf("unexpected data type %v", a)
Expand Down
2 changes: 1 addition & 1 deletion propagators/b3/b3_propagator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func TestB3EncodingOperations(t *testing.T) {
for i, e := range encodings {
for j := i + 1; j < i+len(encodings); j++ {
o := encodings[j%len(encodings)]
assert.False(t, e == o, "%v == %v", e, o)
assert.NotEqual(t, e, o, "%v == %v", e, o)
}
}

Expand Down

0 comments on commit d9fab90

Please sign in to comment.