-
Notifications
You must be signed in to change notification settings - Fork 187
Extend return_linter
to allow prefix exclusions
#2335
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
Comments
It would be nice for RUnit exclusions to supply But |
Here are the tests we dropped from the initial PR for
And here's the implementation that is dropped for now: if (use_runit) {
side_effect_functions <- union(side_effect_functions, c(".setUp", ".tearDown"))
# tests in the RUnit framework are functions ending with a call to one
# of the below. would rather users just use a different framework
# (e.g. testthat or tinytest), but already 250+ BUILD files depend
# on RUnit, so just cater to that. confirmed the efficiency impact
# of including these is minimal.
# RUnit tests look like 'TestInCamelCase <- function()'
# NB: check for starts-with(text(), 'Test') below is not sufficient, e.g.
# in cases of a "driver" test function taking arguments and the main unit
# test iterating over those.
allowed_functions <- union(
allowed_functions,
c(
"checkEquals", "checkEqualsNumeric", "checkException", "checkIdentical",
"checkStop", "checkTrue", "checkWarnings"
)
)
ignore_start <- "
or (
preceding-sibling::expr/SYMBOL[starts-with(text(), 'Test')]
and not(SYMBOL_FORMALS)
)
"
} else {
ignore_start <- ""
} |
WDYT about Alternatively, we could support a list input:
OTOH, the downside is it's hard to pass such a check through to XPath since XPath1.0 doesn't support any regex engine. So maybe it's best to leave this down to glob matching, and convert the glob to either |
Regarding pushdown to XPath I wouldn't worry too much, it might be worthwhile to capture and cache assignment exprs, too. |
What about adding rudimentary globbing support to
except=
? It could detect*
at the end of exceptions and convert those entries to prefix-exclusions.Originally posted by @AshesITR in #2271 (comment)
The text was updated successfully, but these errors were encountered: