Skip to content
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

Draft: Refactor internal workflows #52

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
linters:
linters_with_defaults(
object_length_linter = NULL,
object_name_linter = NULL,
cyclocomp_linter = NULL
)
8 changes: 6 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Authors@R:
comment = c(ORCID = "0000-0002-3120-1601")
),
person(
"Doug", "Kelkhoff", ,
"[email protected]",
"Doug", "Kelkhoff",
email = "[email protected]",
role = c("aut"),
comment = c(ORCID = "0009-0003-7845-4061")
),
Expand All @@ -31,13 +31,17 @@ URL:
BugReports: https://github.com/Genentech/checked/issues
License: MIT + file LICENSE
Encoding: UTF-8
Depends:
R (>= 3.6.2)
Imports:
callr,
cli,
igraph,
jsonlite,
memoise,
R6,
rcmdcheck,
rlang,
utils (>= 3.6.2),
tools
Roxygen: list(markdown = TRUE)
Expand Down
124 changes: 83 additions & 41 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,31 +1,66 @@
# Generated by roxygen2: do not edit by hand

S3method("[",checked_results)
S3method(check_path,package_spec)
S3method(check_path,package_spec_archive_source)
S3method(check_path,package_spec_source)
S3method(as_desc,character)
S3method(as_desc,check_task)
S3method(as_desc,default)
S3method(as_desc,install_task)
S3method(as_desc,pkg_origin_local)
S3method(as_desc,pkg_origin_repo)
S3method(as_desc,subtasks_task)
S3method(check_path,pkg_origin)
S3method(check_path,pkg_origin_archive)
S3method(check_path,pkg_origin_local)
S3method(check_path,pkg_origin_repo)
S3method(count,default)
S3method(count,issues)
S3method(count,potential_issues)
S3method(format,list_of_task_spec)
S3method(format,task_spec)
S3method(dep_tree,character)
S3method(dep_tree,check_task)
S3method(dep_tree,install_task)
S3method(dep_tree,pkg_origin)
S3method(flatten,default)
S3method(flatten,subtasks_task)
S3method(format,filepath)
S3method(format,lib_loc)
S3method(format,listof)
S3method(format,pkg_origin)
S3method(format,task)
S3method(format_status_line_ansi,check_process)
S3method(format_status_line_ansi,default)
S3method(get_package_spec_dependencies,default)
S3method(get_package_spec_dependencies,package_spec)
S3method(get_package_spec_dependencies,package_spec_archive_source)
S3method(get_package_spec_dependencies,package_spec_source)
S3method(install_parameters,package_spec)
S3method(install_parameters,package_spec_archive_source)
S3method(install_parameters,package_spec_source)
S3method(print,check_design)
S3method(friendly_class,task)
S3method(friendly_name,check_task)
S3method(friendly_name,default)
S3method(friendly_name,install_task)
S3method(friendly_name,library_task)
S3method(friendly_name,task)
S3method(install_params,pkg_origin)
S3method(install_params,pkg_origin_archive)
S3method(install_params,pkg_origin_base)
S3method(install_params,pkg_origin_local)
S3method(install_params,pkg_origin_repo)
S3method(is_type,list)
S3method(is_type,process)
S3method(is_type,task)
S3method(lib,"NULL")
S3method(lib,character)
S3method(lib,check_task)
S3method(lib,install_task)
S3method(lib,lib_loc_default)
S3method(lib,lib_loc_isolated)
S3method(lib,task)
S3method(pkg_deps,default)
S3method(pkg_deps,pkg_origin_archive)
S3method(pkg_deps,pkg_origin_local)
S3method(plot,task_graph)
S3method(print,checked_results)
S3method(print,checked_results_check_task_spec)
S3method(print,checked_results_revdep_check_task_spec)
S3method(print,checked_results_check_task)
S3method(print,checked_results_revdep_check_task)
S3method(print,checker)
S3method(print,issues)
S3method(print,potential_issues)
S3method(print,rcmdcheck_diff)
S3method(print,task_spec)
S3method(print,task)
S3method(report_finalize,"NULL")
S3method(report_finalize,reporter_ansi_tty)
S3method(report_finalize,reporter_basic_tty)
Expand All @@ -37,43 +72,50 @@ S3method(report_sleep,reporter_ansi_tty)
S3method(report_status,"NULL")
S3method(report_status,reporter_ansi_tty)
S3method(report_status,reporter_basic_tty)
S3method(results,check_design)
S3method(results,check_task_spec)
S3method(results,list_check_task_spec)
S3method(results,list_revdep_check_task_spec)
S3method(results,revdep_check_task_spec)
S3method(results,check_task)
S3method(results,checker)
S3method(results,list_check_task)
S3method(results,list_revdep_check_task)
S3method(results,revdep_check_task)
S3method(run,character)
S3method(run,check_design)
S3method(start_task,check_task_spec)
S3method(start_task,custom_install_task_spec)
S3method(start_task,install_task_spec)
S3method(summary,check_design)
S3method(run,checker)
S3method(start_task,check_task)
S3method(start_task,custom_install_task)
S3method(start_task,install_task)
S3method(summary,checked_results)
S3method(summary,checked_results_check_task_spec)
S3method(summary,checked_results_revdep_check_task_spec)
export(check_design)
S3method(summary,checked_results_check_task)
S3method(summary,checked_results_revdep_check_task)
S3method(summary,checker)
export(as_visNetwork)
export(check_dev_rev_deps)
export(check_dir)
export(check_pkgs)
export(check_rev_deps)
export(check_task_spec)
export(custom_install_task_spec)
export(install_task_spec)
export(new_check_design)
export(new_rev_dep_check_design)
export(package_spec)
export(package_spec_archive_source)
export(package_spec_source)
export(check_task)
export(checker)
export(custom_install_task)
export(install_task)
export(new_checker)
export(new_rev_dep_checker)
export(pkg_origin)
export(pkg_origin_archive)
export(pkg_origin_base)
export(pkg_origin_is_base)
export(pkg_origin_local)
export(pkg_origin_repo)
export(pkg_origin_unknown)
export(plan_checks)
export(plan_rev_dep_checks)
export(reporter_ansi_tty)
export(reporter_basic_tty)
export(reporter_default)
export(results)
export(results_to_file)
export(rev_dep_check_tasks_df)
export(revdep_check_task_spec)
export(revdep_check_task)
export(run)
export(source_check_tasks_df)
export(task_spec)
export(start_task.igraph.vs)
export(task)
export(try_pkg_origin_repo)
import(cli)
importFrom(R6,R6Class)
importFrom(callr,r_process)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

* Add tests for the reverse dependency check use case.

* Make `install_packages_process` capture session's `available_packages_filters`
* Make `install_process` capture session's `available_packages_filters`
and reuse them when installing packages to ensure consistency with the main
session filtering.

Expand Down
3 changes: 3 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Considering

* moving task class into a separate vector attribute
96 changes: 46 additions & 50 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#' @param ... Additional arguments passed to [`run()`]
#'
#' @return
#' [`check_design()`] R6 class storing all the details
#' [`checker()`] R6 class storing all the details
#' regarding checks that run. Can be combined with
#' [`results`] and [`summary()`] methods to generate results.
#'
Expand Down Expand Up @@ -55,27 +55,25 @@ NULL
#' @family checks
#' @export
check_rev_deps <- function(
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(), # nolint object_name_linter
repos = getOption("repos"),
reverse_repos = repos,
restore = TRUE,
reporter = reporter_default(),
...) {
checks <- rev_dep_check_tasks_df(path = path, repos = reverse_repos)

plan <- check_design$new(
checks,
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(),
repos = getOption("repos"),
reverse_repos = repos,
restore = TRUE,
...
) {
checks <- checker$new(
plan_rev_dep_checks(path = path, repos = reverse_repos),
n = n,
output = output,
lib.loc = lib.loc,
repos = repos,
)

run(plan, ...)
plan
run(checks, ...)
checks
}

#' Run reverse dependency checks against a development version only
Expand All @@ -94,26 +92,25 @@ check_rev_deps <- function(
#' @family checks
#' @export
check_dev_rev_deps <- function(
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(), # nolint object_name_linter
repos = getOption("repos"),
restore = TRUE,
...) {
checks <- rev_dep_check_tasks_df(path = path, repos = repos, versions = "dev")

plan <- check_design$new(
checks,
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(),
repos = getOption("repos"),
restore = TRUE,
...
) {
checks <- checker$new(
plan_rev_dep_checks(path = path, repos = repos, versions = "dev"),
n = n,
output = output,
lib.loc = lib.loc,
repos = repos,
restore = restore
)

run(plan, ...)
plan
run(checks, ...)
checks
}

#' Check one or more package source directories
Expand All @@ -130,26 +127,25 @@ check_dev_rev_deps <- function(
#' @family checks
#' @export
check_pkgs <- function(
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(), # nolint object_name_linter
repos = getOption("repos"),
restore = TRUE,
...) {
checks <- source_check_tasks_df(path)

plan <- check_design$new(
checks,
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(),
repos = getOption("repos"),
restore = TRUE,
...
) {
checks <- checker$new(
plan_checks(path),
n = n,
output = output,
lib.loc = lib.loc,
repos = repos,
restore = restore
)

run(plan, ...)
plan
run(checks, ...)
checks
}

#' Check all package source directories in current directory
Expand All @@ -165,16 +161,16 @@ check_pkgs <- function(
#' @family checks
#' @export
check_dir <- function(
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(), # nolint object_name_linter
repos = getOption("repos"),
restore = TRUE,
...) {
path,
n = 2L,
output = tempfile(paste(utils::packageName(), Sys.Date(), sep = "-")),
lib.loc = .libPaths(),
repos = getOption("repos"),
restore = TRUE,
...
) {
dirs <- list.dirs(path, full.names = TRUE, recursive = FALSE)
r_packages <- dirs[vlapply(dirs, path_is_pkg)]

check_pkgs(
r_packages,
n = n,
Expand Down
10 changes: 6 additions & 4 deletions R/check_process.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ RE_CHECK <- paste0(
)
# nolint end, styler: on

DEFAULT_R_CMD_CHECK_VARIABLES <- c( # nolint
DEFAULT_R_CMD_CHECK_ENVVARS <- c( # nolint
"_R_CHECK_FORCE_SUGGESTS_" = FALSE,
"_R_CHECK_RD_XREFS_" = FALSE,
"_R_CHECK_SYSTEM_CLOCK_" = FALSE,
"_R_CHECK_SUGGESTS_ONLY_" = TRUE
)

DEFAULT_BUILD_ARGS <- c( # nolint
DEFAULT_R_CMD_BUILD_ARGS <- c( # nolint
"--no-build-vignettes",
"--no-manual"
)

DEFAULT_CHECK_ARGS <- c( # nolint
DEFAULT_R_CMD_CHECK_ARGS <- c( # nolint
"--timings",
"--ignore-vignettes",
"--no-manual"
Expand All @@ -52,7 +52,9 @@ check_process <- R6::R6Class(
private$throttle <- throttle()
private$spinners <- list(
check = silent_spinner("circleHalves"),
starting = silent_spinner(list(frames = c("\u2834", "\u2826", "\u2816", "\u2832")))
starting = silent_spinner(list(
frames = c("\u2834", "\u2826", "\u2816", "\u2832")
))
)

super$initialize(...)
Expand Down
Loading