Skip to content

Refactor/cli messages - #731

Draft
timcadman wants to merge 5 commits into
v7.0-devfrom
refactor/cli-messages
Draft

timcadman wants to merge 5 commits into
v7.0-devfrom
refactor/cli-messages

Conversation

@timcadman

@timcadman timcadman commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

dslite_lib <- tools::R_user_dir("dsBaseClient-demo", "data")
dir.create(dslite_lib, recursive = TRUE, showWarnings = FALSE)
if (!dir.exists(file.path(dslite_lib, "dsBase"))) {
install.packages("dsBase_7.0.0.tar.gz", repos = NULL, lib = dslite_lib)
}
.libPaths(c(dslite_lib, .libPaths()))

library(DSI)
library(DSLite)
library(dsBase)
devtools::load_all(".", quiet = TRUE)

options(datashield.errors.print = TRUE)
options(datashield.progress = FALSE)

login.data <- DSLite::setupDATASETTest("dsBase")
conns <- datashield.login(logins = login.data, assign = TRUE)

ds.asCharacter(x.name = "D$NUMERIC", newobj = "mixed", datasources = conns[1])
ds.asNumeric(x.name = "D$NUMERIC", newobj = "mixed", datasources = conns[2:3])
ds.rep(x1 = 1, times = 5, source.times = "c", newobj = "short", datasources = conns[1])
ds.asList(x.name = "D$NUMERIC", newobj = "mylist", datasources = conns)

demo_cli_messages_02_run.R:
run <- function(expr) {
withCallingHandlers(
tryCatch(expr, error = function(e) cat(rlang::cnd_message(e, prefix = TRUE), "\n")),
warning = function(w) { cat(rlang::cnd_message(w, prefix = TRUE), "\n"); invokeRestart("muffleWarning") }
)
cat("\n")
invisible(NULL)
}

.checkArgProvided

run(ds.metadata(x = NULL, datasources = conns))

.checkArgsSet

run(ds.rBinom(samp.size = NULL, newobj = "x", datasources = conns))

.resolveNewobjName / .checkNewobjName

run(ds.asNumeric(x.name = "D$NUMERIC", newobj = 1:2, datasources = conns))

.seedAsText

run(ds.rNorm(seed.as.integer = "abc", newobj = "x", datasources = conns))

.abortInvalidChoice

run(ds.rowColCalc("D", operation = "bogus", datasources = conns))

.expandToStudies

run(ds.rNorm(mean = c(1, 2), newobj = "x", datasources = conns))

.warnOffsetInFormula

run(ds.glm("D$NUMERIC~D$INTEGER+offset(D$POSITIVE_NUMERIC)", family = "gaus))

.verifyDatasources / .resolveDatasources

run(ds.metadata(x = "D", datasources = list(1, 2)))

checkClass (via ds.summary)

run(ds.summary("mixed", datasources = conns))

isDefined (via ds.glm -> glmChecks)

run(ds.glm("D$NOPECOLUMN~D$INTEGER", family = "gaussian", checks = TRUE, datasources = conns[1]))

.checkClassConsistency (via ds.boxPlot)

run(ds.boxPlot("D$CHARACTER", datasources = conns))

.checkObjectClasses (via ds.rbind)

run(ds.rbind("mylist", DataSHIELD.checks = TRUE, datasources = conns))

.checkMultiObjectConsistency (via ds.cbind)

run(ds.cbind(x = c("D", "D"), DataSHIELD.checks = TRUE, datasources = conns
run(ds.cbind(x = c("D", "short"), DataSHIELD.checks = TRUE, datasources = c

glmChecks (via ds.glm, negative weight)

run(ds.glm("D$NUMERIC~D$INTEGER", family = "gaussian", weights = "D$NEGATIVE_NUMERIC", checks = TRUE, datasources = conns[1]))

ds.table

run(ds.table("D$CHARACTER", datasources = conns))

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
❌ 4 of 5 checks failed
CheckResult
Devtools checks❌ failed
Code quality❌ 14 new findings (package total: 1906)
Armadillo unit tests❌ [ FAIL 3 | WARN 0 | SKIP 21 | PASS 10754 ]
Opal unit tests❌ [ FAIL 1 | WARN 0 | SKIP 11 | PASS 4870 ]
Test coverageℹ️ no coverable lines changed (project: 70.5%)

Tested against dsBase versions:
Armadillo: 7.0.0.9000
Opal: 7.0.0.9000

Logs: Devtools checks · Code quality · Armadillo unit tests · Opal unit tests · Codecov

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
⏳ 0 of 5 checks reported so far
CheckResult
Devtools checks⏳ pending
Code quality⏳ pending
Armadillo unit tests⏳ pending
Opal unit tests⏳ pending
Test coverage⏳ pending

Tested against dsBase versions:
Armadillo: pending
Opal: pending

Logs: pending · pending · pending · pending · pending

Comment thread R/ds.table.R
}

return(list(validity.message=validity.message,error.messages=error.messages))
failures <- paste0(names(error.messages), ": ", unlist(error.messages))
Comment thread R/utils.R
if(is.null(df)){
cli_abort("Please provide the name of a data.frame or matrix!")
.checkArgsSet <- function(..., call = parent.frame()) {
args <- list(...)
lapply(study_names, function(study) if (is.function(reply)) reply(study, expr) else reply)
}
assign_nothing <- function(...) invisible(NULL)
testthat::local_mocked_bindings(datashield.aggregate = answer, datashield.assign = assign_nothing,
assign_nothing <- function(...) invisible(NULL)
testthat::local_mocked_bindings(datashield.aggregate = answer, datashield.assign = assign_nothing,
.package = "DSI", .env = env)
testthat::local_mocked_bindings(datashield.aggregate = answer, datashield.assign = assign_nothing,

test_that("ds.cbind and ds.dataFrame warn about duplicate names and reject unequal rows", {
fake_server(classDS = "numeric")
testthat::local_mocked_bindings(ds.length = function(x, ...) list(if (x == "a") 3 else 4))

test_that("ds.kurtosis and ds.skewness report too few observations for a combined result", {
fake_server()
testthat::local_mocked_bindings(ds.mean = function(...) list(Global.Mean = matrix(NA, 1, 1, dimnames = list(NULL, "EstimatedMean"))))
list(pattern = pattern, valid = TRUE, message = "Valid")
}

one_bar <- structure(list(breaks = 1:2, counts = 1, density = 1, mids = 1.5, xname = "x", equidist = TRUE),
Comment thread R/utils.R
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @noRd
.abortInvalidChoice <- function(argName, choices, call = parent.frame()) {
value <- get(argName, envir = call)
Comment thread R/glmChecks.R
}else{
call0 <- call("isNaDS", elts[i])
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, elts[i]) }
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, elts[i], call = call) }
Comment thread R/glmChecks.R
clnames <- unlist(DSI::datashield.aggregate(datasources[j], cally))
if(!(elts[i] %in% clnames)){
dd <- isDefined(datasources, elts[i])
dd <- isDefined(datasources, elts[i], call = call)
Comment thread R/glmChecks.R
dd <- isDefined(datasources, elts[i], call = call)
call0 <- call("isNaDS", elts[i])
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, elts[i]) }
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, elts[i], call = call) }
Comment thread R/glmChecks.R
}else{
call0 <- call("isNaDS", paste0(data, "$", elts[i]))
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, paste0(data, "$", elts[i])) }
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, paste0(data, "$", elts[i]), call = call) }
Comment thread R/glmChecks.R
}
}else{
defined <- isDefined(datasources, elts[i])
defined <- isDefined(datasources, elts[i], call = call)
Comment thread R/glmChecks.R
defined <- isDefined(datasources, elts[i], call = call)
call0 <- call("isNaDS", elts[i])
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, elts[i]) }
if(varIdentifier[i] == "offset" | varIdentifier[i] == "weights"){ typ <- checkClass(datasources, elts[i], call = call) }

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants