Skip to content

Commit bd81272

Browse files
authored
Merge pull request #39 from getwilds/dev
Regulated data features
2 parents 6cc21e3 + ab04969 commit bd81272

13 files changed

Lines changed: 46 additions & 46 deletions

.github/workflows/lint.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
21
on:
32
push:
4-
branches: [main, auth-change]
53
pull_request:
6-
branches: [main, auth-change]
74

85
name: lint
96

@@ -15,17 +12,8 @@ jobs:
1512
steps:
1613
- uses: actions/checkout@v4
1714

18-
- uses: r-lib/actions/setup-r@v2
19-
with:
20-
use-public-rspm: true
15+
- name: Install Air
16+
uses: posit-dev/setup-air@v1
2117

22-
- uses: r-lib/actions/setup-r-dependencies@v2
23-
with:
24-
extra-packages: any::lintr, local::.
25-
needs: lint
26-
27-
- name: Lint
28-
run: lintr::lint_package()
29-
shell: Rscript {0}
30-
env:
31-
LINTR_ERROR_ON_LINT: true
18+
- name: Check
19+
run: air format . --check

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: proofr
22
Title: Client for the PROOF API
3-
Version: 0.4.0
4-
Authors@R:
3+
Version: 0.5.0
4+
Authors@R:
55
person("Scott", "Chamberlain", , "sachamber@fredhutch.org", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-1444-9135"))
77
Description: Client for the PROOF API.
@@ -15,12 +15,12 @@ Imports:
1515
cli,
1616
glue,
1717
httr2
18-
Suggests:
18+
Suggests:
1919
jsonlite,
2020
knitr,
2121
rmarkdown,
2222
testthat (>= 3.0.0),
23-
webmockr (>= 1.0.0),
23+
webmockr (>= 2.2.0),
2424
withr
2525
Config/testthat/edition: 3
2626
VignetteBuilder: knitr

Makefile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ readme:
3131
${RSCRIPT} -e "knitr::knit('README.Rmd')"
3232

3333
lint_package:
34-
${RSCRIPT} -e "lintr::lint_package()"
34+
air format . --check
3535

36-
# use: `make style_file FILE=stuff.R`
37-
# ("R/" is prepended); accepts 1 file only
38-
style_file:
39-
${RSCRIPT} -e 'styler::style_file(${FILE_TARGET})'
40-
41-
style_package:
42-
${RSCRIPT} -e "styler::style_pkg()"
36+
fix_package:
37+
air format .

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# proofr v0.5.0
2+
3+
* Support for regulated data features in the PROOF API
4+
* Formatting code - changed to using Posit's air formatter
5+
16
# proofr v0.4.0
27

38
* Bumping timeout from 5 seconds to 20 seconds (@sckott in [direct commit](https://github.com/getwilds/proofr/commit/cbe9062fd73e61992b46035e7ac2241cd8de2541))

R/start.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#' here as a string. Either pass it using [Sys.getenv()] or save your
1111
#' token as an env var and then passing nothing to this param and we'll find
1212
#' it
13+
#' @param regulated_data (logical) whether to use a scratch directory
14+
#' in regulated storage.
1315
#' @details Does not return PROOF/Cromwell server URL, for that you have to
1416
#' periodically call [proof_status()], or wait for the email from the
1517
#' PROOF API
@@ -21,11 +23,18 @@
2123
#' You do however need to have a Cromwell server up and running to
2224
#' retrieve data.
2325
#' @return A list with fields:
24-
#' - `job_id` (character) - the job ID
26+
#' - `job_id` (character) - the job ID =
2527
#' - `info` (character) - message
26-
proof_start <- function(slurm_account = NULL, token = NULL) {
28+
proof_start <- function(
29+
slurm_account = NULL,
30+
token = NULL,
31+
regulated_data = FALSE
32+
) {
2733
request(make_url("cromwell-server")) |>
28-
req_body_json(list(slurm_account = slurm_account)) |>
34+
req_body_json(list(
35+
slurm_account = slurm_account,
36+
regulated_data = regulated_data
37+
)) |>
2938
proof_header(token) |>
3039
req_timeout(proofr_env$timeout_sec) |>
3140
req_error(body = error_body) |>

R/utils.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ make_url <- function(...) {
99
assert <- function(x, y) {
1010
if (!is.null(x)) {
1111
if (!inherits(x, y)) {
12-
stop(deparse(substitute(x)), " must be of class ",
12+
stop(
13+
deparse(substitute(x)),
14+
" must be of class ",
1315
paste0(y, collapse = ", "),
1416
call. = FALSE
1517
)

man/proof_start.Rd

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-proof_authenticate.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ test_that("proof_start - success", {
4444
expect_type(auth_res, "character")
4545
expect_equal(auth_res, "somerandomstring")
4646

47-
4847
stub_registry_clear()
4948
disable(quiet = TRUE)
5049
Sys.unsetenv("PROOF_TOKEN")

tests/testthat/test-proof_cancel.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ test_that("proof_cancel - success", {
1717
expect_type(cancel_res$message, "character")
1818
expect_match(cancel_res$message, "cancelled")
1919

20-
2120
stub_registry_clear()
2221
disable(quiet = TRUE)
2322
})
@@ -37,7 +36,6 @@ test_that("proof_cancel - not running, can not cancel", {
3736
expect_error(proof_cancel(), "Additional context")
3837
})
3938

40-
4139
stub_registry_clear()
4240
disable(quiet = TRUE)
4341
})

tests/testthat/test-proof_header.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
test_that("proof_header", {
44
# errors if no env var set and no string supplied
5-
expect_error(proof_header(request("")), "token not found")
5+
withr::with_envvar(new = c("PROOF_TOKEN" = ""), {
6+
expect_error(proof_header(request("")), "token not found")
7+
})
68

79
# returns token if given
810
expect_match(proof_header(request(""), "adf")$headers[[1]], "adf")

0 commit comments

Comments
 (0)