-
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
Add examples to documentation: Part-5 (l-n) #1655
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1655 +/- ##
=======================================
Coverage 98.49% 98.49%
=======================================
Files 101 101
Lines 4456 4456
=======================================
Hits 4389 4389
Misses 67 67
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
#' lint( | ||
#' text = "mean(x, )", | ||
#' linters = missing_argument_linter(allow_trailing = TRUE) | ||
#' ) |
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.
not a good example I think, since this may be erroneous to use. better to use a list2() example, maybe filter() or tibble() or mutate(), to demonstrate a case where the lint is more subjective as opposed to avoiding errors
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.
I have changed the example, but still wanted to understand your comment.
Under what circumstances will this be the case?
this may be erroneous to use
x <- c(1, 2, 3)
mean(x, )
#> [1] 2
Created on 2022-10-10 with reprex v2.0.2
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.
You're right, I was speaking a bit more generally (hadn't check if mean(x, )
works)... point being it's very hard to tell at a glance whether code like that will run or not (and hence a lint is really good), whereas I think allow_trailing=TRUE
is intended to allow a common source of false positives through (namely, list2()
usages)
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.
Gotcha!
R/missing_package_linter.R
Outdated
#' @examples | ||
#' # will produce lints | ||
#' lint( | ||
#' text = "library(statts)", |
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.
I worry statts is too close to something that could conceivably be a real package name (if not now, then eventually). maybe pick something more obscure?
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.
Can't think of something that I don't see being a package name, so chose xyzxyz
. Happy to change if you can think of something better.
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.
SGTM, I also think a gibberish name is OK...
Except
nonportable_path_linter()
; I will come back to it later.Part of #1492