Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
^CRAN-SUBMISSION$
^CONTRIBUTING\.md$
^\.claude$
^.*\.stackdump$
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ We are open to any contribution, from typos to new features. We will guide you t

## Package versions required to develop

- `{roxygen2}`: Version > `7.1.2` is required.
- `{roxygen2}`: Version `>= 7.3.0` is required, and the package is
documented with the version declared in `Config/roxygen2/version`.
Note that a package documented by `{roxygen2}` 8.x carries
`Config/roxygen2/version` instead of `RoxygenNote`, and that
`{usethis}` (<= 3.2.1) only looks at `RoxygenNote`: `usethis::use_pipe()`,
`use_import_from()`, `use_lifecycle()` and their siblings therefore
abort with "does not use roxygen2" on this repository. Edit
`NAMESPACE` roxygen tags by hand instead.

## Fixing typos

Expand Down
12 changes: 7 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: checkhelper
Title: Deal with Check Outputs
Version: 1.0.0.9000
Version: 1.0.1
Authors@R: c(
person("Vincent", "Guyader", , "vincent@thinkr.fr", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0671-9270")),
Expand All @@ -19,7 +19,7 @@ URL: https://thinkr-open.github.io/checkhelper/,
https://github.com/ThinkR-open/checkhelper
BugReports: https://github.com/ThinkR-open/checkhelper/issues
Depends:
R (>= 4.0)
R (>= 4.1)
Imports:
cli,
covr,
Expand All @@ -34,7 +34,7 @@ Imports:
pkgload,
purrr,
rcmdcheck,
roxygen2,
roxygen2 (>= 7.3.0),
stringi,
stringr,
tibble,
Expand All @@ -51,8 +51,10 @@ Suggests:
VignetteBuilder:
knitr
Config/Needs/website: ThinkR-open/thinkrtemplate
Config/testthat/edition: 3
Config/testthat/start-first: checkhelper, fix-globals*, audit-globals,
check_as_cran, check_clean_userspace*, check_n_covr, audit-userspace
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Config/roxygen2/version: 8.1.0
50 changes: 29 additions & 21 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,36 @@ export(get_no_visible)
export(get_notes)
export(print_globals)
export(use_data_doc)
importFrom(dplyr,filter)
importFrom(dplyr,first)
importFrom(dplyr,group_by)
importFrom(dplyr,if_else)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,n)
importFrom(dplyr,pull)
importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,tibble)
importFrom(dplyr,ungroup)
importFrom(glue,glue)
importFrom(glue,glue_collapse)
importFrom(dplyr,
filter,
first,
group_by,
if_else,
left_join,
mutate,
n,
pull,
rename,
select,
summarise,
tibble,
ungroup
)
importFrom(glue,
glue,
glue_collapse
)
importFrom(lifecycle,deprecated)
importFrom(magrittr,"%>%")
importFrom(purrr,compact)
importFrom(purrr,keep)
importFrom(purrr,map)
importFrom(purrr,walk)
importFrom(purrr,
compact,
keep,
map,
walk
)
importFrom(rcmdcheck,rcmdcheck)
importFrom(stringr,str_extract)
importFrom(stringr,str_extract_all)
importFrom(stringr,
str_extract,
str_extract_all
)
importFrom(utils,getFromNamespace)
28 changes: 27 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
# checkhelper 1.0.0.9000 (development version, GitHub only)
# checkhelper 1.0.1

## Breaking changes

- {checkhelper} now requires R >= 4.1: the {roxygen2} 8.x series
shipped by CRAN requires it, so the previous `R (>= 4.0)` claim was
not installable in practice with current dependencies. {roxygen2}
>= 7.3.0 (the oldest version the test suite supports) is now
declared explicitly in `Imports`.

## Bug fixes

- Compatibility with roxygen2 8.x. roxygen2 8.0.0 migrates the
DESCRIPTION `RoxygenNote` field to `Config/roxygen2/version`. On
every CRAN flavor that has picked up roxygen2 8.x (the four r-devel
Linux flavors, r-patched-linux, r-release-windows and
r-oldrel-windows) this made a
`find_missing_tags()` test abort: it used `usethis::use_pipe()` as
scaffolding, and usethis's internal roxygen detection
(`usethis:::uses_roxygen()`) still relies on
the now-removed `RoxygenNote` field, so `use_pipe()` failed with
*"Package ... does not use roxygen2"*. The scaffolding re-exported the
magrittr `%>%` purely to add functions to the fixture; it was never
part of the asserted contract, so it has been removed (modern packages
use the native `|>`, which needs no setup). The audit pipeline itself
(`audit_tags()` / `find_missing_tags()`), which reimplements
`roxygenise()` through roxygen2 internals, was verified to remain
correct under roxygen2 8.1.0. A dedicated regression test
(`test-roxygen2-8x-compat.R`) now guards the whole audit flow against
the roxygen2 8.x field migration and block-classification changes.
- `fix_globals(write = TRUE)` no longer flattens the per-function
`# <fun>:` grouping comments of an existing `R/globals.R` when a
second run has nothing new to declare. When R CMD check surfaces
Expand Down
14 changes: 8 additions & 6 deletions R/audit_ascii.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
#' @export
#' @seealso [fix_ascii()] to apply the rewrite, [find_nonascii_files()].
#' @examples
#' \dontrun{
#' pkg <- create_example_pkg()
#' audit_ascii(pkg)
#' if (requireNamespace("usethis", quietly = TRUE) &&
#' requireNamespace("attachment", quietly = TRUE)) {
#' pkg <- create_example_pkg()
#' audit_ascii(pkg)
#' }
audit_ascii <- function(pkg = ".",
scope = c("R", "tests", "vignettes", "man",
Expand Down Expand Up @@ -64,9 +65,10 @@ audit_ascii <- function(pkg = ".",
#' @export
#' @seealso [audit_ascii()], [asciify_pkg()].
#' @examples
#' \dontrun{
#' pkg <- create_example_pkg()
#' fix_ascii(pkg, dry_run = TRUE)
#' if (requireNamespace("usethis", quietly = TRUE) &&
#' requireNamespace("attachment", quietly = TRUE)) {
#' pkg <- create_example_pkg()
#' fix_ascii(pkg, dry_run = TRUE)
#' }
fix_ascii <- function(pkg = ".",
scope = c("R", "tests", "vignettes"),
Expand Down
7 changes: 4 additions & 3 deletions R/audit_tags.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#' @export
#' @seealso [find_missing_tags()]
#' @examples
#' \dontrun{
#' pkg <- create_example_pkg()
#' audit_tags(pkg)
#' if (requireNamespace("usethis", quietly = TRUE) &&
#' requireNamespace("attachment", quietly = TRUE)) {
#' pkg <- create_example_pkg()
#' audit_tags(pkg)
#' }
audit_tags <- function(pkg = ".") {
out <- .find_missing_tags(package.dir = pkg)
Expand Down
5 changes: 4 additions & 1 deletion R/create_example_pkg.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
#' @export
#' @return Path where the example package is stored.
#' @examples
#' create_example_pkg()
#' if (requireNamespace("usethis", quietly = TRUE) &&
#' requireNamespace("attachment", quietly = TRUE)) {
#' create_example_pkg()
#' }
create_example_pkg <- function(path = tempfile(pattern = "pkg-"),
with_functions = TRUE,
with_extra_notes = FALSE,
Expand Down
2 changes: 1 addition & 1 deletion R/globals.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
globalVariables(
utils::globalVariables(
unique(
c(
"is_importfrom", "importfrom_function", "is_global_variable",
Expand Down
47 changes: 25 additions & 22 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
## Submission summary

This is a feature release of {checkhelper} (1.0.0). The previous CRAN
version was 0.1.0. The release introduces a uniform `audit_*` /
`fix_*` API for CRAN-blocking issues (globals, roxygen tags,
non-ASCII, userspace leaks, CRAN-settings checks, undocumented
datasets, old-style CITATION, `\dontrun{}` blocks, unquoted package
names in DESCRIPTION, network/download calls) plus a one-pass
`check_n_covr()` helper. The 10 historic functions remain callable
behind `lifecycle::deprecate_warn()` and delegate to the new
facades, so no reverse dependency breaks. See `NEWS.md` for the
full mapping.

The maintainer changes from Sebastien Rochette to Vincent Guyader.
Sebastien Rochette stays in `Authors@R` with a `previous maintainer`
note in `comment =`.
This is a patch release of {checkhelper} (1.0.1). The previous CRAN
version was 1.0.0.

It fixes the test failure that triggered the archival notice. The
failure is not flavor specific: it is currently reported on the four
r-devel Linux flavors (debian and fedora, clang and gcc),
r-patched-linux-x86_64, r-release-windows-x86_64 and
r-oldrel-windows-x86_64, that is on every flavor that has already
picked up {roxygen2} 8.x.

The cause is {roxygen2} 8.0.0 migrating the `RoxygenNote` DESCRIPTION
field to `Config/roxygen2/version`. {usethis} (<= 3.2.1) still detects
roxygen through the old field, so a {usethis}-based test scaffolding
step aborted with "does not use roxygen2". The test suite has been
fixed, a regression test added, and the declared dependencies aligned
({roxygen2} >= 7.3.0, R >= 4.1). The test suite passes with both
{roxygen2} 8.1.0 and 7.3.3. See `NEWS.md` for details.

## Test environments

* local: Ubuntu Linux, R-release
* GitHub Actions: ubuntu-latest, macos-latest, windows-latest
(R-release and R-devel)
* win-builder: R-release and R-devel
* local: Windows 11, R 4.5.0, checked twice, once with roxygen2 7.3.3
and once with roxygen2 8.1.0
* GitHub Actions: ubuntu-latest (R-devel, R-release, R-oldrel),
macos-latest (R-release), windows-latest (R-release), all with
roxygen2 8.1.0
* win-builder: R-devel

## R CMD check results

0 errors | 0 warnings | 0 notes

## Reverse dependencies

We checked the reverse dependencies of {checkhelper} on CRAN. No
breakage detected: the deprecated functions still dispatch to the
new facades with a `lifecycle::deprecate_warn()` and an unchanged
return shape.
No API change in this release: only tests, documentation, and
declared dependency floors were touched.
7 changes: 4 additions & 3 deletions man/audit_ascii.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/audit_tags.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/checkhelper-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/create_example_pkg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions man/find_missing_tags.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/fix_ascii.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 19 additions & 18 deletions tests/testthat/helpers.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
test_that("Package version required", {

# Check the version of the package roxygen2 to take into account the breaking change.
expect_true(packageVersion("roxygen2") > "7.1.2")
# Silence expected lifecycle deprecations for the current test.
local_quiet_deprecation <- function(envir = parent.frame()) {
withr::local_options(lifecycle_verbosity = "quiet", .local_envir = envir)
}

})
# Discard output and messages for the current test.
# For file-scope fixtures, use `quiet_create_example_pkg()` instead.
local_quiet <- function(envir = parent.frame()) {
if (sink.number(type = "message") == 2L) {
withr::local_message_sink(nullfile(), .local_envir = envir)
}
withr::local_output_sink(nullfile(), .local_envir = envir)
invisible()
}
Comment thread
VincentGuyader marked this conversation as resolved.

# Silence lifecycle deprecation warnings globally; tests that explicitly
# exercise the deprecation layer override this with `withr::local_options()`.
options(lifecycle_verbosity = "quiet")
# Create the example package without toolchain output or expected warnings.
quiet_create_example_pkg <- function(...) {
local_quiet(environment())
suppressWarnings(create_example_pkg(...))
}

# Snapshot tempdir() at test entry and unlink anything new at teardown.
# Use this in tests that call rcmdcheck (audit_globals/fix_globals path)
# so they don't leak artefacts that downstream tests
# (test-check_clean_userspace) detect as pre-existing files.
#
# `envir` defaults to the caller's frame, which is the right thing inside
# a `test_that()` block. When called at FILE scope (e.g. before any
# `test_that` runs), pass `envir = testthat::teardown_env()` so the
# deferred cleanup ties to the file's documented teardown environment
# rather than to the source frame's lifetime.
# Remove files added to `tempdir()` when the test or file completes.
local_tempdir_clean <- function(envir = parent.frame()) {
before <- list.files(tempdir(), all.files = TRUE, no.. = TRUE)
withr::defer(
Expand Down
Loading