Skip to content

Commit

Permalink
Merge pull request #51 from insightsengineering/fix_max_indirect
Browse files Browse the repository at this point in the history
include refs for indirect deps
  • Loading branch information
pawelru authored Jul 26, 2024
2 parents f346850 + 2dc2ed4 commit 54ea47d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Config/testthat/edition: 3
8 changes: 4 additions & 4 deletions R/deps_installation_proposal.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ new_max_deps_installation_proposal <- function(path, # nolint
config <- append_config(default_config(), config)

d <- desc::desc(path)
d <- desc_add_extra_deps(d, extra_deps)

refs <- get_refs_from_desc(d)
new_refs <- list()
Expand All @@ -75,7 +76,6 @@ new_max_deps_installation_proposal <- function(path, # nolint
new_refs_str <- map_key_character(new_refs, "ref")

d <- desc_cond_set_refs(d, new_refs_str)
d <- desc_add_extra_deps(d, extra_deps)

res <- desc_to_ip(d, config)
class(res) <- c("max_deps_installation_proposal", "deps_installation_proposal", class(res))
Expand All @@ -96,6 +96,7 @@ new_release_deps_installation_proposal <- function(path, # nolint
config <- append_config(default_config(), config)

d <- desc::desc(path)
d <- desc_add_extra_deps(d, extra_deps)

refs <- get_refs_from_desc(d)
new_refs <- list()
Expand All @@ -108,7 +109,6 @@ new_release_deps_installation_proposal <- function(path, # nolint
new_refs_str <- map_key_character(new_refs, "ref")

d <- desc_cond_set_refs(d, new_refs_str)
d <- desc_add_extra_deps(d, extra_deps)
d <- desc_remotes_cleanup(d)

res <- desc_to_ip(d, config)
Expand All @@ -131,6 +131,7 @@ new_min_cohort_deps_installation_proposal <- function(path, # nolint
config <- append_config(default_config(), config)

d <- desc::desc(path)
d <- desc_add_extra_deps(d, extra_deps)

refs <- get_refs_from_desc(d)
# convert github to standard if possible
Expand Down Expand Up @@ -163,7 +164,6 @@ new_min_cohort_deps_installation_proposal <- function(path, # nolint
)
new_refs_str <- map_key_character(new_refs, "ref")
d <- desc_cond_set_refs(d, new_refs_str)
d <- desc_add_extra_deps(d, extra_deps)
d <- desc_remotes_cleanup(d)

# find PPM snapshot
Expand Down Expand Up @@ -237,6 +237,7 @@ new_min_isolated_deps_installation_proposal <- function(path, # nolint
config <- append_config(default_config(), config)

d <- desc::desc(path)
d <- desc_add_extra_deps(d, extra_deps)

refs <- get_refs_from_desc(d)

Expand Down Expand Up @@ -272,7 +273,6 @@ new_min_isolated_deps_installation_proposal <- function(path, # nolint
new_refs_str <- map_key_character(new_refs, "ref")

d <- desc_cond_set_refs(d, new_refs_str)
d <- desc_add_extra_deps(d, extra_deps)
d <- desc_remotes_cleanup(d)

res <- desc_to_ip(d, config)
Expand Down
28 changes: 28 additions & 0 deletions tests/testthat/test-deps_installation_proposal.R
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,31 @@ test_that("new_max_deps_installation_proposal correctly handles Bioc package", {

test_proposal_common_bioc(x, "SummarizedExperiment")
})

# ################################################################

test_that("indirect dependencies in the config field - ignore on default", {
skip_if_offline()

d_std_path <- local_description(list(dplyr = "Import"), need_verdepcheck = c("tidyverse/dplyr", "r-lib/rlang"))

x <- new_max_deps_installation_proposal(d_std_path)

withr::defer(unlink(x$get_config()$library))

d_new <- desc::desc(gsub("^deps::", "", x$get_refs()))
expect_false("r-lib/rlang" %in% d_new$get_list("Config/Needs/verdepcheck"))
})

test_that("indirect dependencies in the config field - include on match with `extra_deps`", {
skip_if_offline()

d_std_path <- local_description(list(dplyr = "Import"), need_verdepcheck = c("tidyverse/dplyr", "r-lib/rlang"))

x <- new_max_deps_installation_proposal(d_std_path, extra_deps = "rlang")

withr::defer(unlink(x$get_config()$library))

d_new <- desc::desc(gsub("^deps::", "", x$get_refs()))
expect_true("r-lib/rlang" %in% d_new$get_list("Config/Needs/verdepcheck"))
})

0 comments on commit 54ea47d

Please sign in to comment.