Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
^dev-lib$
^LICENSE\.md$
^codecov\.yml$
^[\.]?air\.toml$
^\.vscode$
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

name: R-CMD-check.yaml

Expand Down Expand Up @@ -43,8 +43,8 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-tinytex@v2

- uses: r-lib/actions/setup-r@v2
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage.yaml

Expand All @@ -18,6 +17,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-tinytex@v2

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -35,14 +35,16 @@ jobs:
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
files: ./cobertura.xml
plugins: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"Posit.air-vscode"
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[r]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "Posit.air-vscode"
}
}
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Version: 1.4.0.9000
Authors@R: c(
person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("cre", "aut")),
person("Mango Solutions", role = c("cph", "fnd")),
person("Posit Software, PBC", role = c("cph", "fnd"))
person("Posit Software, PBC", role = c("cph", "fnd"),
comment = c(ROR = "03wc8by49"))
)
Description: Run 'R CMD check' from 'R' and capture the results of the
individual checks. Supports running checks in the background,
Expand Down Expand Up @@ -40,6 +41,7 @@ Suggests:
webfakes
Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Config/usethis/last-upkeep: 2025-05-07
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2023
YEAR: 2025
COPYRIGHT HOLDER: rcmdcheck authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2023 rcmdcheck authors
Copyright (c) 2025 rcmdcheck authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* Update pkgdown template and move url to https://rcmdcheck.r-lib.org.

* `cran_check_results()` works again.

# rcmdcheck 1.4.0

* `cran_check_results()` now downloads results in parallel, so it is
Expand Down Expand Up @@ -37,7 +39,7 @@
`rcmdcheck.test_output` global option, to control whether to print the full
test output or not. (#121)

* RStudio's Pandoc is now on the path during `rcmdcheck()`
* RStudio's Pandoc is now on the path during `rcmdcheck()`
and `rcmdcheck_process` (#109, #132, @dpprdan).

* `rcmdcheck()` now errors if the check process crashes (#110, #163).
Expand Down
1 change: 0 additions & 1 deletion R/api.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#' Query R CMD check results and parameters
#'
#' @param check A check result.
Expand Down
74 changes: 50 additions & 24 deletions R/background.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#' Run an `R CMD check` process in the background
#'
#' rcmdcheck_process is an R6 class, that extends the
Expand Down Expand Up @@ -60,15 +59,29 @@ rcmdcheck_process <- R6Class(
inherit = callr::rcmd_process,

public = list(

initialize = function(path = ".", args = character(),
build_args = character(), check_dir = NULL, libpath = .libPaths(),
repos = getOption("repos"), env = character())
rcc_init(self, private, super, path, args, build_args, check_dir,
libpath, repos, env),

parse_results = function()
rcc_parse_results(self, private),
initialize = function(
path = ".",
args = character(),
build_args = character(),
check_dir = NULL,
libpath = .libPaths(),
repos = getOption("repos"),
env = character()
)
rcc_init(
self,
private,
super,
path,
args,
build_args,
check_dir,
libpath,
repos,
env
),

parse_results = function() rcc_parse_results(self, private),

read_output_lines = function(...) {
l <- super$read_output_lines(...)
Expand All @@ -86,10 +99,9 @@ rcmdcheck_process <- R6Class(
private$killed <- TRUE
super$kill(...)
}

),
private = list(
path = NULL,
path = NULL,
check_dir = NULL,
targz = NULL,
description = NULL,
Expand All @@ -104,9 +116,18 @@ rcmdcheck_process <- R6Class(
#' @importFrom callr rcmd_process rcmd_process_options
#' @importFrom desc desc

rcc_init <- function(self, private, super, path, args, build_args,
check_dir, libpath, repos, env) {

rcc_init <- function(
self,
private,
super,
path,
args,
build_args,
check_dir,
libpath,
repos,
env
) {
if (file.info(path)$isdir) {
path <- find_package_root_file(path = path)
} else {
Expand All @@ -126,8 +147,13 @@ rcc_init <- function(self, private, super, path, args, build_args,

pkgbuild::without_cache(pkgbuild::local_build_tools())

targz <- build_package(path, check_dir, build_args = build_args,
libpath = libpath, quiet = TRUE)
targz <- build_package(
path,
check_dir,
build_args = build_args,
libpath = libpath,
quiet = TRUE
)

private$description <- desc(path)
private$path <- path
Expand All @@ -146,7 +172,7 @@ rcc_init <- function(self, private, super, path, args, build_args,
# probably inside test cases of some package
if (Sys.getenv("R_TESTS", "") == "") {
private$session_output <- tempfile()
private$tempfiles <- c(private$session_output, profile)
private$tempfiles <- c(private$session_output, profile)
profile <- make_fake_profile(package, private$session_output, libdir)
chkenv["R_TESTS"] <- profile
}
Expand Down Expand Up @@ -182,12 +208,12 @@ rcc_parse_results <- function(self, private) {
on.exit(unlink(private$tempfiles, recursive = TRUE), add = TRUE)

new_rcmdcheck(
stdout = paste(win2unix(private$cstdout), collapse = ""),
stderr = paste(win2unix(private$cstderr), collapse = ""),
description = private$description,
status = self$get_exit_status(),
duration = duration(self$get_start_time()),
timeout = private$killed,
stdout = paste(win2unix(private$cstdout), collapse = ""),
stderr = paste(win2unix(private$cstderr), collapse = ""),
description = private$description,
status = self$get_exit_status(),
duration = duration(self$get_start_time()),
timeout = private$killed,
session_info = private$session_output
)
}
21 changes: 13 additions & 8 deletions R/build.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#' @importFrom pkgbuild pkgbuild_process
#' @importFrom withr with_envvar

Expand All @@ -17,7 +16,8 @@ build_package <- function(path, tmpdir, build_args, libpath, quiet) {
clean_doc <- as_flag(desc$get("Config/build/clean-inst-doc"), NULL)

with_envvar(
c("R_LIBS_USER" = paste(libpath, collapse = .Platform$path.sep)), {
c("R_LIBS_USER" = paste(libpath, collapse = .Platform$path.sep)),
{
proc <- pkgbuild_process$new(
path,
tmpdir,
Expand All @@ -28,23 +28,28 @@ build_package <- function(path, tmpdir, build_args, libpath, quiet) {
on.exit(proc$kill(), add = TRUE)

callback <- detect_callback()
while (proc$is_incomplete_output() ||
proc$is_incomplete_error()
|| proc$is_alive()) {
while (
proc$is_incomplete_output() ||
proc$is_incomplete_error() ||
proc$is_alive()
) {
proc$poll_io(-1)
out <- proc$read_output()
err <- proc$read_error()
if (!quiet) {
out <- sub("(checking for file .)/.*DESCRIPTION(.)",
"\\1.../DESCRIPTION\\2", out, perl = TRUE)
out <- sub(
"(checking for file .)/.*DESCRIPTION(.)",
"\\1.../DESCRIPTION\\2",
out,
perl = TRUE
)
callback(out)
callback(err)
}
}
proc$get_built_file()
}
)

} else {
dest <- file.path(tmpdir, basename(path))
if (!file.exists(dest) || normalizePath(dest) != path) {
Expand Down
10 changes: 4 additions & 6 deletions R/callback.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## This is the callback called for each line of the output
## We color it a bit, OK is green, NOTE is blue
## WARNING is magenta, ERROR is red.
Expand All @@ -8,10 +7,10 @@
#' @importFrom prettyunits pretty_dt

block_callback <- function(
top_line = TRUE,
sys_time = NULL,
as_cran = NA) {

top_line = TRUE,
sys_time = NULL,
as_cran = NA
) {
sys_time <- sys_time %||% Sys.time
partial_line <- ""

Expand Down Expand Up @@ -49,7 +48,6 @@ block_callback <- function(
}

do_line <- function(x) {

should_time <<- FALSE
now <<- sys_time()

Expand Down
12 changes: 6 additions & 6 deletions R/compare.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#' Compare a set of check results to another check result
#'
#' @param old A check result, or a list of check results.
Expand All @@ -9,8 +8,8 @@
#' * `status`: comparison status, see below,
#' * `old`: list of `rcmdcheck` objects the old check(s),
#' * `new`: `rcmdcheck` object, the new check,
#' * `cmp`:
#'
#' * `cmp`:
#'
#'
#' @family check comparisons
#' @export
Expand All @@ -36,10 +35,11 @@ compare_check_files <- function(old, new) {
#' @family check comparisons
#' @export

compare_to_cran <- function(check,
flavours = cran_check_flavours(check$package)) {
compare_to_cran <- function(
check,
flavours = cran_check_flavours(check$package)
) {
pkg <- check$package
cran <- cran_check_results(pkg, flavours = flavours)
compare_checks(old = cran, new = check)
}

Loading
Loading