Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump github.com/Antonboom/testifylint from 1.5.2 to 1.6.0 #5540

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 98 additions & 90 deletions .golangci.next.reference.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/Abirdcfly/dupword v0.1.3
github.com/Antonboom/errname v1.0.0
github.com/Antonboom/nilnil v1.0.1
github.com/Antonboom/testifylint v1.5.2
github.com/Antonboom/testifylint v1.6.0
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
github.com/Crocmagnon/fatcontext v0.7.1
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3198,6 +3198,7 @@
"contains",
"empty",
"encoded-compare",
"equal-values",
"error-is-as",
"error-nil",
"expected-actual",
Expand All @@ -3212,6 +3213,7 @@
"suite-broken-parallel",
"suite-dont-use-pkg",
"suite-extra-assert-call",
"suite-method-signature",
"suite-subtest-run",
"suite-thelper",
"useless-assert"
Expand All @@ -3224,6 +3226,7 @@
"contains",
"empty",
"encoded-compare",
"equal-values",
"error-is-as",
"error-nil",
"expected-actual",
Expand All @@ -3238,6 +3241,7 @@
"suite-broken-parallel",
"suite-dont-use-pkg",
"suite-extra-assert-call",
"suite-method-signature",
"suite-subtest-run",
"useless-assert"
]
Expand All @@ -3253,6 +3257,7 @@
"contains",
"empty",
"encoded-compare",
"equal-values",
"error-is-as",
"error-nil",
"expected-actual",
Expand All @@ -3267,8 +3272,8 @@
"suite-broken-parallel",
"suite-dont-use-pkg",
"suite-extra-assert-call",
"suite-method-signature",
"suite-subtest-run",
"suite-thelper",
"useless-assert"
],
"default": [
Expand Down Expand Up @@ -3311,6 +3316,11 @@
"description": "To require f-assertions (e.g. assert.Equalf) if format string is used, even if there are no variable-length variables.",
"type": "boolean",
"default": false
},
"require-string-msg": {
"description": "To require that the first element of msgAndArgs (msg) has a string type.",
"type": "boolean",
"default": true
}
}
},
Expand Down
1 change: 1 addition & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ type TestifylintSettings struct {
Formatter struct {
CheckFormatString *bool `mapstructure:"check-format-string"`
RequireFFuncs bool `mapstructure:"require-f-funcs"`
RequireStringMsg bool `mapstructure:"require-string-msg"`
} `mapstructure:"formatter"`

GoRequire struct {
Expand Down
3 changes: 2 additions & 1 deletion pkg/golinters/testifylint/testdata/fix/in/testifylint.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func TestTestifylint(t *testing.T) {
assert.Nil(t, err) // want "error-nil: use assert\\.NoError"
assert.Equal(t, resultInt, 42) // want "expected-actual: need to reverse actual and expected values"
assert.Equal(t, resultFloat, 42.42) // want "float-compare: use assert\\.InEpsilon \\(or InDelta\\)"
assert.Equal(t, len(arr), 10) // want "len: use assert\\.Len"
assert.Equal(t, len(arr), 10) // want "expected-actual: need to reverse actual and expected values"
assert.Equal(t, 10, len(arr)) // want "len: use assert\\.Len"

assert.True(t, predicate)
assert.Equal(t, resultInt, 1) // want "expected-actual: need to reverse actual and expected values"
Expand Down
1 change: 1 addition & 0 deletions pkg/golinters/testifylint/testdata/fix/out/testifylint.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func TestTestifylint(t *testing.T) {
assert.NoError(t, err) // want "error-nil: use assert\\.NoError"
assert.Equal(t, 42, resultInt) // want "expected-actual: need to reverse actual and expected values"
assert.Equal(t, resultFloat, 42.42) // want "float-compare: use assert\\.InEpsilon \\(or InDelta\\)"
assert.Equal(t, 10, len(arr)) // want "expected-actual: need to reverse actual and expected values"
assert.Len(t, arr, 10) // want "len: use assert\\.Len"

assert.True(t, predicate)
Expand Down
3 changes: 2 additions & 1 deletion pkg/golinters/testifylint/testdata/testifylint.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func TestTestifylint(t *testing.T) {
assert.Nil(t, err) // want "error-nil: use assert\\.NoError"
assert.Equal(t, resultInt, 42) // want "expected-actual: need to reverse actual and expected values"
assert.Equal(t, resultFloat, 42.42) // want "float-compare: use assert\\.InEpsilon \\(or InDelta\\)"
assert.Equal(t, len(arr), 10) // want "len: use assert\\.Len"
assert.Equal(t, len(arr), 10) // want "expected-actual: need to reverse actual and expected values"
assert.Equal(t, 10, len(arr)) // want "len: use assert\\.Len"

assert.True(t, predicate)
assert.Equal(t, resultInt, 1) // want "expected-actual: need to reverse actual and expected values"
Expand Down
3 changes: 2 additions & 1 deletion pkg/golinters/testifylint/testdata/testifylint_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func TestTestifylint(t *testing.T) {
assert.Nil(t, err) // want "error-nil: use assert\\.NoError"
assert.Equal(t, resultInt, 42) // want "expected-actual: need to reverse actual and expected values"
assert.Equal(t, resultFloat, 42.42) // want "float-compare: use assert\\.InEpsilon \\(or InDelta\\)"
assert.Equal(t, len(arr), 10) // want "len: use assert\\.Len"
assert.Equal(t, len(arr), 10) // want "expected-actual: need to reverse actual and expected values"
assert.Equal(t, 10, len(arr)) // want "len: use assert\\.Len"

assert.True(t, predicate)
assert.Equal(t, resultInt, 1) // want "expected-actual: need to reverse actual and expected values"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//golangcitest:args -Etestifylint
//golangcitest:config_path testdata/testifylint_formatter_dont_require_string_msg.yml
package testdata

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestTestifylint(t *testing.T) {
var b bool
assert.True(t, b, b)
assert.True(t, b, "msg %v", 1)
assert.True(t, b, b, 1) // want "formatter: using msgAndArgs with non-string first element \\(msg\\) causes panic"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
linters-settings:
testifylint:
disable-all: true
enable:
- formatter
formatter:
check-format-string: false
require-f-funcs: false
require-string-msg: false
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ import (
func TestTestifylint(t *testing.T) {
var err error
var args []any
var b bool
assert.Error(t, err, "Parse(%v) should fail.", args) // want "formatter: use assert\\.Errorf$"

assert.Equal(t, 1, 2, fmt.Sprintf("msg")) // want "formatter: remove unnecessary fmt\\.Sprintf and use assert\\.Equalf"
assert.DirExistsf(t, "", "msg with arg", 42)

assert.True(t, b, b) // want "formatter: do not use non-string value as first element \\(msg\\) of msgAndArgs"
assert.True(t, b, b, 1) // want "formatter: using msgAndArgs with non-string first element \\(msg\\) causes panic"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ linters-settings:
formatter:
check-format-string: false
require-f-funcs: true
require-string-msg: true
1 change: 1 addition & 0 deletions pkg/golinters/testifylint/testifylint.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func New(settings *config.TestifylintSettings) *goanalysis.Linter {

"bool-compare.ignore-custom-types": settings.BoolCompare.IgnoreCustomTypes,
"formatter.require-f-funcs": settings.Formatter.RequireFFuncs,
"formatter.require-string-msg": settings.Formatter.RequireStringMsg,
"go-require.ignore-http-handlers": settings.GoRequire.IgnoreHTTPHandlers,
}
if len(settings.EnabledCheckers) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion test/testshared/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ type RunnerResult struct {
func (r *RunnerResult) ExpectNoIssues() {
r.tb.Helper()

assert.Equal(r.tb, "", r.output, "exit code is %d", r.exitCode)
assert.Empty(r.tb, r.output, "exit code is %d", r.exitCode)
assert.Equal(r.tb, exitcodes.Success, r.exitCode, "output is %s", r.output)
}

Expand Down