Skip to content

Commit f247139

Browse files
authored
Merge pull request #194 from pharmaverse/pre-release
Release 0.2
2 parents 2576708 + e9d7a19 commit f247139

File tree

110 files changed

+4132
-1484
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+4132
-1484
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
^vignettes/git_usage\.Rmd$
1818
^vignettes/writing_vignettes\.Rmd$
1919
^vignettes/unit_test_guidance\.Rmd$
20+
^vignettes/release_strategy\.Rmd$
2021
^vignettes/.+png$
2122
^LICENSE\.md$
2223
^\.github$

.github/pull_request_template.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiral/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent.
1+
Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiraldev/devel/articles/development_process.html) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent.
22

33
Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `devel` branch until you have checked off each task.
44

55
- [ ] Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
66
- [ ] Code is formatted according to the [tidyverse style guide](https://style.tidyverse.org/). Run `styler::style_file()` to style R and Rmd files
7-
- [ ] Updated relevant unit tests or have written new unit tests - See [Unit Test Guide](https://pharmaverse.github.io/admiral/articles/unit_test_guidance.html)
8-
- [ ] If you removed/replaced any function and/or function parameters, did you fully follow the [deprecation guidance](https://pharmaverse.github.io/admiral/articles/programming_strategy.html#deprecation)?
9-
- [ ] Update to all relevant roxygen headers and examples.
7+
- [ ] Updated relevant unit tests or have written new unit tests, which should consider realistic data scenarios and edge cases, e.g. empty datasets, errors, boundary cases etc. - See [Unit Test Guide](https://pharmaverse.github.io/admiraldev/devel/articles/unit_test_guidance.html#tests-should-be-robust-to-cover-realistic-data-scenarios)
8+
- [ ] If you removed/replaced any function and/or function parameters, did you fully follow the [deprecation guidance](https://pharmaverse.github.io/admiraldev/devel/articles/programming_strategy.html#deprecation)?
9+
- [ ] Update to all relevant roxygen headers and examples, including keywords and families. Refer to the [categorization of functions](https://pharmaverse.github.io/admiraldev/devel/articles/programming_strategy.html#categorization-of-functions) to tag appropriate keyword/family.
1010
- [ ] Run `devtools::document()` so all `.Rd` files in the `man` folder and the `NAMESPACE` file in the project root are updated appropriately
1111
- [ ] Address any updates needed for vignettes and/or templates
1212
- [ ] Update `NEWS.md` if the changes pertain to a user-facing function (i.e. it has an `@export` tag) or documentation aimed at users (rather than developers)
13-
- [ ] Build admiral site `pkgdown::build_site()` and check that all affected examples are displayed correctly and that all new functions occur on the "[Reference](https://pharmaverse.github.io/admiral/reference/index.html)" page.
13+
- [ ] Build admiral site `pkgdown::build_site()` and check that all affected examples are displayed correctly and that all new functions occur on the "[Reference](https://pharmaverse.github.io/admiraldev/devel/reference/index.html)" page.
1414
- [ ] Address or fix all lintr warnings and errors - `lintr::lint_package()`
1515
- [ ] Run `R CMD check` locally and address all errors and warnings - `devtools::check()`
16-
- [ ] Link the issue so that it closes after successful merging.
17-
- [ ] Address all merge conflicts and resolve appropriately.
16+
- [ ] Link the issue in the Development Section on the right hand side.
17+
- [ ] Address all merge conflicts and resolve appropriately
1818
- [ ] Pat yourself on the back for a job well done! Much love to your accomplishment!

.github/workflows/common.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,25 @@ jobs:
4545
uses: pharmaverse/admiralci/.github/workflows/style.yml@main
4646
if: github.event_name == 'pull_request'
4747
with:
48-
r-version: $R_VERSION
48+
r-version: "4.0"
4949
spellcheck:
5050
name: Spelling
5151
uses: pharmaverse/admiralci/.github/workflows/spellcheck.yml@main
5252
if: github.event_name == 'pull_request'
5353
with:
54-
r-version: $R_VERSION
54+
r-version: "4.0"
5555
readme:
5656
name: Render README
5757
uses: pharmaverse/admiralci/.github/workflows/readme-render.yml@main
5858
if: github.event_name == 'push'
5959
with:
60-
r-version: $R_VERSION
60+
r-version: "4.0"
6161
validation:
6262
name: Validation
6363
uses: pharmaverse/admiralci/.github/workflows/r-pkg-validation.yml@main
6464
if: github.event_name == 'release'
6565
with:
66-
r-version: $R_VERSION
66+
r-version: "4.0"
6767
check:
6868
name: Check
6969
uses: pharmaverse/admiralci/.github/workflows/r-cmd-check.yml@main
@@ -73,17 +73,19 @@ jobs:
7373
uses: pharmaverse/admiralci/.github/workflows/pkgdown.yml@main
7474
if: github.event_name == 'push'
7575
with:
76-
r-version: $R_VERSION
76+
r-version: "4.0"
7777
# Whether to skip multiversion docs
7878
# Note that if you have multiple versions of docs,
7979
# your URL links are likely to break due to path changes
8080
skip-multiversion-docs: false
81+
# Ref to use for the multiversion docs landing page
82+
multiversion-docs-landing-page: devel
8183
linter:
8284
name: Lint
8385
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main
8486
if: github.event_name == 'pull_request'
8587
with:
86-
r-version: $R_VERSION
88+
r-version: "4.0"
8789
links:
8890
name: Links
8991
uses: pharmaverse/admiralci/.github/workflows/links.yml@main
@@ -95,7 +97,7 @@ jobs:
9597
if: >
9698
github.event_name == 'push' || github.event_name == 'pull_request'
9799
with:
98-
r-version: $R_VERSION
100+
r-version: "4.0"
99101
# Whether to skip code coverage badge creation
100102
# Setting to 'false' will require you to create
101103
# an orphan branch called 'badges' in your repository
@@ -105,4 +107,4 @@ jobs:
105107
uses: pharmaverse/admiralci/.github/workflows/man-pages.yml@main
106108
if: github.event_name == 'pull_request'
107109
with:
108-
r-version: $R_VERSION
110+
r-version: "4.0"

DESCRIPTION

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
11
Package: admiraldev
22
Type: Package
33
Title: Development Tools for the Admiral Package Family
4-
Version: 0.1.0
4+
Version: 0.2.0
55
Authors@R: c(
66
person("Ben", "Straub", email = "ben.x.straub@gsk.com", role = c("aut", "cre")),
77
person("Stefan", "Bundfuss", role = "aut"),
88
person("Thomas", "Neitmann", role = "aut"),
99
person("Samia", "Kabi", role = "aut"),
1010
person("Pooja", "Kumari", role = "aut"),
1111
person("Syed", "Mubasheer", role = "aut"),
12+
person("Ross", "Farrugia", role = "aut"),
13+
person("Sadchla", "Mascary", role = "aut"),
14+
person("Zelos", "Zhu", role = "aut"),
15+
person("Jeffrey", "Dickinson", role = "aut"),
16+
person("Ania", "Golab", role = "aut"),
1217
person("Ondrej", "Slama", role = "ctb"),
1318
person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")),
1419
person("GlaxoSmithKline LLC", role = c("cph", "fnd"))
1520
)
1621
Description: Utility functions to check data, variables and conditions for functions used in
17-
'admiral' and 'admiral' extension packages. Additional utility helper functions to to assist developers
22+
'admiral' and 'admiral' extension packages. Additional utility helper functions to assist developers
1823
with maintaining documentation, testing and general upkeep of 'admiral' and 'admiral' extension packages.
1924
License: Apache License (>= 2)
2025
URL: https://pharmaverse.github.io/admiraldev/main/, https://github.com/pharmaverse/admiraldev/
2126
Encoding: UTF-8
2227
Language: en-US
2328
LazyData: false
2429
Roxygen: list(markdown = TRUE)
25-
RoxygenNote: 7.2.0
30+
RoxygenNote: 7.2.1
2631
Depends: R (>= 3.5)
2732
Imports:
28-
assertthat,
29-
dplyr,
30-
lubridate,
31-
magrittr,
32-
purrr,
33-
rlang,
34-
stringr,
35-
hms,
36-
tidyr,
37-
tidyselect,
38-
lifecycle
33+
dplyr (>= 0.8.4),
34+
hms (>= 0.5.3),
35+
lifecycle (>= 0.1.0),
36+
lubridate (>= 1.7.4),
37+
magrittr (>= 1.5),
38+
purrr (>= 0.3.3),
39+
rlang (>= 0.4.4),
40+
stringr (>= 1.4.0),
41+
tidyr (>= 1.0.2),
42+
tidyselect (>= 1.0.0)
3943
Suggests:
4044
admiral.test,
4145
devtools,

NAMESPACE

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
export("%notin%")
44
export("%or%")
5+
export(add_suffix_to_vars)
56
export(anti_join)
67
export(arg_name)
78
export(as_name)
9+
export(assert_atomic_vector)
810
export(assert_character_scalar)
911
export(assert_character_vector)
1012
export(assert_data_frame)
1113
export(assert_date_var)
14+
export(assert_date_vector)
1215
export(assert_expr)
1316
export(assert_filter_cond)
1417
export(assert_function)
@@ -24,14 +27,15 @@ export(assert_one_to_one)
2427
export(assert_order_vars)
2528
export(assert_param_does_not_exist)
2629
export(assert_s3_class)
30+
export(assert_same_type)
2731
export(assert_symbol)
2832
export(assert_unit)
2933
export(assert_vars)
3034
export(assert_varval_list)
3135
export(backquote)
36+
export(contains_vars)
3237
export(convert_dtm_to_dtc)
3338
export(dataset_vignette)
34-
export(desc)
3539
export(dquote)
3640
export(enumerate)
3741
export(expect_dfs_equal)
@@ -44,37 +48,24 @@ export(get_new_tmp_var)
4448
export(get_source_vars)
4549
export(inner_join)
4650
export(is_auto)
47-
export(is_date)
4851
export(is_named)
4952
export(is_order_vars)
50-
export(is_timeunit)
51-
export(is_valid_date_entry)
52-
export(is_valid_day)
5353
export(is_valid_dtc)
54-
export(is_valid_hour)
55-
export(is_valid_month)
56-
export(is_valid_sec_min)
57-
export(is_valid_time_entry)
5854
export(left_join)
59-
export(negate_vars)
6055
export(quo_c)
6156
export(quo_not_missing)
6257
export(remove_tmp_vars)
58+
export(replace_symbol_in_quo)
6359
export(replace_values_by_names)
64-
export(set_dataset)
6560
export(squote)
6661
export(suppress_warning)
6762
export(valid_time_units)
68-
export(vars)
6963
export(vars2chr)
7064
export(warn_if_incomplete_dtc)
7165
export(warn_if_inconsistent_list)
7266
export(warn_if_invalid_dtc)
7367
export(warn_if_vars_exist)
7468
export(what_is_it)
75-
importFrom(assertthat,"on_failure<-")
76-
importFrom(assertthat,assert_that)
77-
importFrom(assertthat,is.number)
7869
importFrom(dplyr,arrange)
7970
importFrom(dplyr,bind_cols)
8071
importFrom(dplyr,bind_rows)
@@ -172,6 +163,7 @@ importFrom(rlang,is_logical)
172163
importFrom(rlang,is_quosure)
173164
importFrom(rlang,is_quosures)
174165
importFrom(rlang,is_symbol)
166+
importFrom(rlang,missing_arg)
175167
importFrom(rlang,new_formula)
176168
importFrom(rlang,parse_expr)
177169
importFrom(rlang,parse_exprs)
@@ -195,6 +187,7 @@ importFrom(stringr,str_c)
195187
importFrom(stringr,str_detect)
196188
importFrom(stringr,str_extract)
197189
importFrom(stringr,str_glue)
190+
importFrom(stringr,str_match)
198191
importFrom(stringr,str_remove)
199192
importFrom(stringr,str_remove_all)
200193
importFrom(stringr,str_replace)

NEWS.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# admiraldev 0.2.0
2+
3+
## New Features
4+
- Developer addin for formatting tests to admiral programming standards (#73)
5+
- New functions `replace_symbol_in_quo()` and `add_suffix_to_vars()` (#106)
6+
- New function `assert_atomic_vector()` (#98)
7+
- New keyword/family `create_aux` for functions creating auxiliary datasets (#126)
8+
- New function `assert_date_vector()` (#129)
9+
- New function `assert_same_type()` (#176)
10+
- Remove dependency on `{assertthat}` (#149)
11+
- Test coverage for `admiraldev` have increased from 45% to approximately 100% (#94, #95, #96, #98, #101, #103)
12+
- _Environment_ objects were consolidated into a single `admiraldev_environment` object under `R/admiraldev_environment.R`. (#179)
13+
14+
## Updates of Existing Functions
15+
- `expect_names` argument added to `assert_vars()` to check if all variables are named (#117)
16+
- Remove `dplyr` function exports and migration of user facing function `negate_vars()` to admiral (#83)
17+
18+
## Breaking Changes
19+
- No longer compatible with admiral (<0.9)
20+
21+
## Documentation
22+
- New vignette for our package release strategy (#79)
23+
- Updated multiple roxygen headers (#116, #133, #134, #141, #145, #172)
24+
- Description on how admiral options work for certain function inputs, i.e `subject_keys` (#133)
25+
26+
## Various
27+
- PR Checklist Template updated (#172)
28+
- New authors/contributors (#158)
29+
130
# admiraldev 0.1.0
231

332
## New Features
@@ -7,18 +36,14 @@
736
- New `{admiraldev}` website created
837

938
## Updates of Existing Functions
10-
1139
- NA
12-
40+
1341
## Breaking Changes
14-
1542
- NA
1643

1744
## Documentation
18-
1945
- NA
2046

2147
## Various
22-
2348
- NA
2449

R/addin_format_testthat.R

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ prepare_test_that_file <- function(path) {
1919
}
2020

2121
# parse the name of the testing function
22-
testing_fun <- sub("^test-", "", sub(".R$", "", basename(path)))
22+
testing_file <- sub("^test-", "", sub(".R$", "", basename(path)))
2323

2424
# get file content
2525
file_content <- readLines(path)
@@ -47,21 +47,29 @@ prepare_test_that_file <- function(path) {
4747
)
4848
test_that_desc_cleaned <- stringr::str_remove(
4949
string = test_that_desc_parsed,
50-
pattern = paste0(testing_fun, ", ", "test \\d{1,}: ")
50+
pattern = paste0("([\\w\\.]+,? )?[Tt]est \\d{1,} ?: ")
5151
)
5252

53+
# determine name of function which is tested
54+
# the function name can be specified by # function_name ---- comments
55+
function_name <- str_match(file_content, "# ([\\w\\.]+) ----")[, 2]
56+
if (is.na(function_name[1])) {
57+
function_name[1] <- testing_file
58+
}
59+
function_name <- tidyr::fill(data.frame(name = function_name), name)$name
60+
function_name <- function_name[test_that_loc]
61+
5362
# formulate new test descriptions (update only those that don't include test_title)
5463
new_desc <- paste0(
55-
testing_fun, ", ",
56-
"test ", seq_along(test_that_loc), ": ",
64+
"Test ", seq_along(test_that_loc), ": ",
5765
test_that_desc_cleaned
5866
)
5967

6068
# insert new test descriptions into test_that lines
6169
test_that_lines_updated <- stringr::str_replace(
6270
string = test_that_lines,
6371
pattern = '(?<=test_that\\(").*"',
64-
replacement = paste0(new_desc, '"')
72+
replacement = paste0(function_name, " ", new_desc, '"')
6573
)
6674

6775
# modify the file content
@@ -72,10 +80,10 @@ prepare_test_that_file <- function(path) {
7280
####
7381

7482
# formulate headers according to RStudio editor functionality
75-
headers <- paste0("# ---- ", new_desc, " ----")
83+
headers <- paste0("## ", new_desc, " ----")
7684

7785
# get locations of headers created by this function
78-
header_loc_lgl <- grepl(paste0("^# ---- ", testing_fun, ", ", "test \\d{1,}: "), file_content)
86+
header_loc_lgl <- grepl(paste0("^##?( ----)?( \\w+)?,? [tT]est \\d{1,} ?: "), file_content)
7987

8088
# remove those headers
8189
file_content <- file_content[!header_loc_lgl]

R/admiraldev-package.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @importFrom magrittr %>%
77
#' @importFrom rlang := abort arg_match as_function as_label as_string call2 caller_env
88
#' call_name current_env .data enexpr enquo eval_bare eval_tidy expr
9-
#' expr_interp expr_label f_lhs f_rhs inform
9+
#' expr_interp expr_label f_lhs f_rhs inform missing_arg
1010
#' is_bare_formula is_call is_character is_formula is_integerish
1111
#' is_logical is_quosure is_quosures is_symbol new_formula
1212
#' parse_expr parse_exprs quo quo_get_expr quo_is_call
@@ -15,10 +15,9 @@
1515
#' @importFrom utils capture.output str
1616
#' @importFrom purrr map map2 map_chr map_lgl reduce walk keep map_if transpose
1717
#' flatten every modify_at modify_if reduce compose
18-
#' @importFrom stringr str_c str_detect str_extract str_remove str_remove_all
19-
#' str_replace str_trim str_to_lower str_subset str_to_title str_to_upper
20-
#' str_glue
21-
#' @importFrom assertthat assert_that is.number on_failure<-
18+
#' @importFrom stringr str_c str_detect str_extract str_glue str_match
19+
#' str_remove str_remove_all str_replace str_trim str_to_lower str_subset
20+
#' str_to_title str_to_upper
2221
#' @importFrom lubridate as_datetime ceiling_date date days duration floor_date is.Date is.instant
2322
#' time_length %--% ymd ymd_hms weeks years hours minutes
2423
#' @importFrom tidyr drop_na nest pivot_longer pivot_wider unnest

0 commit comments

Comments
 (0)