MyNixOS website logo
Description

Deal with Check Outputs.

Deal with packages 'check' outputs and reduce the risk of rejection by 'CRAN' by following policies.

checkhelper statusbadge R-CMD-check Codecov testcoverage CRANstatus

checkhelper

A toolkit for R package authors that turns each R CMD check warning or NOTE into a clear two-step workflow: audit what the issue is, then fix it. The goal is to reduce the risk of CRAN rejection.

Complete documentation in the {pkgdown} site: https://thinkr-open.github.io/checkhelper/

API at a glance

Each category of CRAN issue gets one read-only audit_*() function and, when an automated fix is safe, one fix_*() function. Type audit_<TAB> or fix_<TAB> in RStudio to discover the surface.

CRAN issueAudit (read-only)Fix (action)
Globals to declare (no visible binding)audit_globals()fix_globals()
Missing roxygen tags (@return, @noRd)audit_tags()-
Non-ASCII charactersaudit_ascii()fix_ascii()
Files left in user space by checksaudit_userspace()-
R CMD check with CRAN settingsaudit_check()-
Undocumented datasetsaudit_dataset_doc()fix_dataset_doc()
Old-style inst/CITATIONaudit_citation()-
\dontrun{} blocks in examplesaudit_dontrun()-
Unquoted package names in DESCRIPTION's Description fieldaudit_description()-
Network / download calls (CRAN-offline-safe pattern)audit_downloads()-

Lower-level helpers (asciify_file(), asciify_r_source(), find_nonascii_tokens(), create_example_pkg()) are also exported for fine-grained scripting.

The 10 historic functions (get_no_visible(), find_missing_tags(), asciify_pkg(), check_as_cran(), …) remain callable but emit a lifecycle::deprecate_warn() and delegate to the new façades - see NEWS.md for the full mapping.

Faster local check: check_n_covr()

check_n_covr(pkg) runs R CMD check (via devtools::check(args = "--no-tests")) and code coverage (via covr::package_coverage(type = "tests")) without running the unit-test suite twice. On a package with a slow test suite this roughly halves the wait. Returns a named list list(check = ..., coverage = ...).

res <- check_n_covr(".")
res$check
covr::percent_coverage(res$coverage)

Installation

From CRAN:

install.packages("checkhelper")

Latest from r-universe:

install.packages("checkhelper", repos = "https://thinkr-open.r-universe.dev")

From GitHub:

remotes::install_github("thinkr-open/checkhelper")

Quick start

The recommended dev-time workflow runs R CMD checkonce and reuses the result across every audit that accepts a checks = argument. create_example_pkg() ships a fake package that trips every audit when you opt into the full set of fixtures - use it to feel the flow end to end:

library(checkhelper)

# `with_nonascii = TRUE` adds a file with French accents in comments
# and strings; `with_undocumented_data = TRUE` saves an undocumented
# dataset under data/. Both default to FALSE for backwards compat.
pkg <- create_example_pkg(with_nonascii = TRUE,
                          with_undocumented_data = TRUE)

# Run R CMD check ONCE.
chk <- rcmdcheck::rcmdcheck(pkg, args = "--as-cran")

# Static audits - no check needed.
audit_tags(pkg)
audit_ascii(pkg)
audit_dataset_doc(pkg)
audit_citation(pkg)
audit_dontrun(pkg)
audit_description(pkg)
audit_downloads(pkg)

# Audits that consume the check - reuse `chk` via the `checks =` argument.
audit_globals(pkg, checks = chk)

# Apply the safe fixes.
fix_globals(pkg, checks = chk, write = TRUE)
fix_ascii(pkg, dry_run = FALSE)
fix_dataset_doc("demo_dataset", pkg = pkg,
                description = "A small demo dataset",
                source = "Generated by create_example_pkg()")

See vignette("auditing-an-r-package", package = "checkhelper") for the full walkthrough (per-issue cheatsheet, when to share chk, how to fix each category). For the heavier final-gate audits - audit_check() (full CRAN environment) and audit_userspace() (no files left after check) - see vignette("pre-submission-gates", package = "checkhelper").

Code of Conduct

Please note that the checkhelper project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Metadata

Version

1.0.0

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows