From ec9755157ed774ffdfca1ad68ea7e5e64c0987ce Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Fri, 29 Mar 2024 16:38:00 +0200 Subject: [PATCH] dev: enable testifylint linter (#4595) --- .golangci.yml | 2 +- pkg/golinters/misspell_test.go | 2 +- pkg/result/processors/autogenerated_exclude_test.go | 1 + pkg/result/processors/skip_files_test.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f7bb319b..d4ff9bcd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -133,6 +133,7 @@ linters: - revive - staticcheck - stylecheck + - testifylint - unconvert - unparam - unused @@ -213,4 +214,3 @@ issues: run: timeout: 5m - diff --git a/pkg/golinters/misspell_test.go b/pkg/golinters/misspell_test.go index 29e0862f..5c590ef9 100644 --- a/pkg/golinters/misspell_test.go +++ b/pkg/golinters/misspell_test.go @@ -29,7 +29,7 @@ func Test_appendExtraWords(t *testing.T) { expected := []string{"iff", "if", "cancelation", "cancellation"} - assert.Equal(t, replacer.Replacements, expected) + assert.Equal(t, expected, replacer.Replacements) } func Test_appendExtraWords_error(t *testing.T) { diff --git a/pkg/result/processors/autogenerated_exclude_test.go b/pkg/result/processors/autogenerated_exclude_test.go index 26cead18..b2a51caf 100644 --- a/pkg/result/processors/autogenerated_exclude_test.go +++ b/pkg/result/processors/autogenerated_exclude_test.go @@ -252,6 +252,7 @@ func Test_shouldPassIssue_error(t *testing.T) { pass, err := p.shouldPassIssue(test.issue) + //nolint:testifylint // It's a loop and the main expectation is the error message. assert.EqualError(t, err, test.expected) assert.False(t, pass) }) diff --git a/pkg/result/processors/skip_files_test.go b/pkg/result/processors/skip_files_test.go index fbea9bb3..3a1129ef 100644 --- a/pkg/result/processors/skip_files_test.go +++ b/pkg/result/processors/skip_files_test.go @@ -49,6 +49,6 @@ func TestSkipFiles(t *testing.T) { func TestSkipFilesInvalidPattern(t *testing.T) { p, err := NewSkipFiles([]string{"\\o"}, "") - assert.Error(t, err) + require.Error(t, err) assert.Nil(t, p) }