-
Notifications
You must be signed in to change notification settings - Fork 6
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
Enable integration of locally-defined checks #40
Comments
@dgkf This issue is an important step in bringing our |
@dgkf I guess you probably checked all this out at some stage too, but the structure of The biggest downside I can see is that these new functions are not "first class" functions like the hard-coded internal ones, and can only be explicitly specified as More importantly, I want to ensure our packages only become more compatible over time, and not less, so don't want to make any design decisions at this point that are likely to reduce compatibility. Happy to discuss here, or we can wait only 2 days now until |
My initial thinking was that there may be more administrative users who may be interested in using these underlying functions to automate a validation process or reports. When we started, the If you're considering not exporting the
Always a good consideration, and a solid reason to keep the functions non-exported to start. |
Thanks @dgkf - i didn't know about that effect of |
This shows how both how to define a check, and the fact that new checks are picked up directly from the global environment. There is a new checks <- pkgcheck(path, extra_env = c (.GlobalEnv, "myotherpkg")) Here's a reprex of it in action: library (pkgcheck)
packageVersion ("pkgcheck")
#> [1] '0.0.2'
path <- srr::srr_stats_pkg_skeleton ()
# ----------------------------- NEW CHECKS START
pkgchk_new_check <- function (checks) {
return (FALSE)
}
output_pkgchk_new_check <- function (checks) {
out <- list (check_pass = checks$checks$new_check,
summary = "",
print = "")
out$summary <- ifelse (out$check_pass,
"**NEW CHECK PASSES**",
"**NEW CHECK DOES NOT PASS**")
return (out)
}
# ----------------------------- NEW CHECKS END
x <- capture.output (suppressMessages ({
roxygen2::roxygenise (path)
checks <- pkgcheck (path)
}))
summary (checks)
#>
#> ── demo 0.0.0.9000 ─────────────────────────────────────────────────────────────
#>
#> ✔ Package name is available
#> ✖ does not have a 'CITATION' file.
#> ✖ does not have a 'codemeta.json' file.
#> ✖ does not have a 'contributing' file.
#> ✔ uses 'roxygen2'.
#> ✖ 'DESCRIPTION' does not have a URL field.
#> ✖ 'DESCRIPTION' does not have a BugReports field.
#> ✖ Package has at no HTML vignettes
#> ✖ These functions do not have examples: [test_fn.Rd].
#> ✖ Continuous integration checks unavailable (no URL in 'DESCRIPTION').
#> ✖ Package coverage is 0% (should be at least 75%).
#> ✖ Statistical standards are missing
#> ✖ This package still has TODO standards and can not be submitted
#> ✖ **NEW CHECK DOES NOT PASS**
#> ✔ R CMD check found no errors.
#> ✔ R CMD check found no warnings.
#>
#> ℹ Current status:
#> ✖ This package is not ready to be submitted.
#> Created on 2021-09-30 by the reprex package (v2.0.1.9000) Checks need only two functions, both of which must accept the single
|
Re-opened because still need to enable new checks to be picked up by print methods |
All done. I won't put reprex here because #library (pkgcheck)
packageVersion ("pkgcheck")
path <- srr::srr_stats_pkg_skeleton ()
pkgchk_new_check <- function (checks) {
return (FALSE)
}
output_pkgchk_new_check <- function (checks) {
out <- list (check_pass = checks$checks$new_check,
summary = "",
print = "")
out$summary <- ifelse (out$check_pass,
"**NEW CHECK PASSES**",
"**NEW CHECK DOES NOT PASS**")
out$print <- list (message = "New check output",
obj = c ("new", "check"))
return (out)
}
x <- capture.output (suppressMessages ({
roxygen2::roxygenise (path)
checks <- pkgcheck (path)
}))
summary (checks)
print (checks)
md <- checks_to_markdown (checks, render = TRUE) The |
Along the lines of
riskmetric
which just greps for specific function prefixes in the namespace.The text was updated successfully, but these errors were encountered: