You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-8
Original file line number
Diff line number
Diff line change
@@ -465,19 +465,29 @@ disable this feature, use `--formatter.check-format-string=false` flag.
465
465
466
466
#### 3)
467
467
468
-
Requirement of the f-assertions if format string is used. Disabled by default, use `--formatter.require-f-funcs` flag
469
-
to enable. This helps follow Go's implicit convention
468
+
Requirement of the f-assertions (e.g. assert.Equal**f**) if format string is used. Disabled by default, use
469
+
`--formatter.require-f-funcs` flag to enable. <br>
470
470
471
-
> Printf-like functions must end with `f`
471
+
This helps follow Go's implicit convention _"Printf-like functions must end with `f`"_ and sets the stage for moving to
472
+
`v2` of `testify`. In this way the checker resembles the [goprintffuncname](https://github.com/jirfag/go-printf-func-name)
473
+
linter (included in [golangci-lint](https://golangci-lint.run/usage/linters/)). <br>
472
474
473
-
and sets the stage for moving to `v2` of `testify`. In this way the checker resembles the
474
-
[goprintffuncname](https://github.com/jirfag/go-printf-func-name) linter (included in
475
-
[golangci-lint](https://golangci-lint.run/usage/linters/)). Also format string in f-assertions is highlighted by IDE
476
-
, e.g. GoLand:
475
+
Also, verbs in the format string of f-assertions are highlighted by an IDE, e.g. GoLand:
477
476
478
477
<imgwidth="600"alt="F-assertion IDE highlighting"src="https://github.com/Antonboom/testifylint/assets/17127404/9bdab802-d6eb-477d-a411-6cba043d33a5">
479
478
480
-
#### Historical Reference
479
+
<br>
480
+
481
+
> [!CAUTION]
482
+
> `--formatter.require-f-funcs` requires f-assertions **even if there are no variable-length variables**, i.e. it
483
+
> requires `require.NoErrorf` for both these cases:
484
+
> ```
485
+
> require.NoErrorf(t, err, "unexpected error")
486
+
> require.NoErrorf(t, err, "unexpected error for sid: %v", sid)
487
+
> ```
488
+
> To understand this behavior, please read the reference below.
0 commit comments