Document the default behavior of require-error
and fn-pattern
#183
-
From reading https://github.com/Antonboom/testifylint#require-error it's not immediately clear to me which calls will be flagged. Initially I assumed there was some default regex for However, it looks like there is actually a hardcoded list of function names, and the regex only serves to filter them down further: https://github.com/Antonboom/testifylint/blob/fc4c8235262c71530c5870869ebe8baa4ad44e6a/internal/checkers/require_error.go#L121C6-L121C7
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi!
exactly so
this is right too in other words – example here: require-error:
# Regexp for assertions to analyze. If defined then only matched assertions will be reported.
# Default: ""
fn-pattern: ^(Errorf?|NoErrorf?)$ ^ it means assert.NoError(t, err)
assert.NoErrorf(t, err, "msg")
assert.Error(t, err)
assert.Errorf(t, err, "msg") other errors assertions (from hardcoded list) will be skipped. You could not specify Please provide an example and goal what you want to reach, thanks |
Beta Was this translation helpful? Give feedback.
-
Got it, thanks for explaining in more detail. I think to make it more clear perhaps I'd suggest a change like this:
into something like
I think that would make it more clear that not every Thanks again! |
Beta Was this translation helpful? Give feedback.
Hi!
exactly so
this is right too
in other words –
require-error
marks any error assertions (how README said), but you could select the specific assertions byfn-pattern
example here:
^ it means
require
will be required (sorry for tautology 🙂) only forother errors assertions (from hardcoded list) wil…