-
Notifications
You must be signed in to change notification settings - Fork 186
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
Catch consecutive calls to assert_that in renamed consecutive_asserion_linter #1940
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1940 +/- ##
=======================================
Coverage 98.94% 98.95%
=======================================
Files 113 113
Lines 4939 4953 +14
=======================================
+ Hits 4887 4901 +14
Misses 52 52
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
#' @seealso [linters] for a complete list of linters available in lintr. | ||
#' @export | ||
consecutive_stopifnot_linter <- function() { | ||
# match on the expr, not the SYMBOL_FUNCTION_CALL, to ensure |
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.
NB: this comment intentionally removed as the logic now lints on cases like:
assert_that(x)
assertthat::assert_that(y)
Technically it would also lint on
SomePkg::stopifnot(x)
base::stopifnot(y)
But that seems unlikely in practice. We could extend the logic to something like "lint if the namespaces are equal or both absent, or if only present once, but not if both present and not equal" but that seems like overkill.
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.
LGTM. Thanks!
Closes #1604