-
Notifications
You must be signed in to change notification settings - Fork 186
Use partial matching for linter names in exclusion directives #1138
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
Conversation
tests/testthat/dummy_projects/project/partially_matched_exclusions.R
Outdated
Show resolved
Hide resolved
test_that("partial matching works for exclusions but warns if no linter found", { | ||
read_settings(NULL) | ||
|
||
expect_warning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really the way to do multiple warning tests in testthat? oh boy 😂
the withCallingHandlers approach is not particularly nicer... maybe we need a helper. i've definitely written expect_warnings()
before.
otoh, it seems like an intentional design decision that testthat has limited matching exactly one warning at a time:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, pretty bulky. I think they should allow to somehow vectorize on regexp
so that multiple warnings each matching some regex are expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed r-lib/testthat#1625 as a suggestion
LGTM after small fix to reduce redundancy |
fixes #872
# nolint
s to the short-hand notationusing_lintr
vignette