Skip to content

Commit

Permalink
Merge pull request #194 from pharmaverse/pre-release
Browse files Browse the repository at this point in the history
Release 0.2
  • Loading branch information
bms63 authored Dec 1, 2022
2 parents 2576708 + e9d7a19 commit f247139
Show file tree
Hide file tree
Showing 110 changed files with 4,132 additions and 1,484 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
^vignettes/git_usage\.Rmd$
^vignettes/writing_vignettes\.Rmd$
^vignettes/unit_test_guidance\.Rmd$
^vignettes/release_strategy\.Rmd$
^vignettes/.+png$
^LICENSE\.md$
^\.github$
Expand Down
14 changes: 7 additions & 7 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
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.
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.

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.

- [ ] Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
- [ ] Code is formatted according to the [tidyverse style guide](https://style.tidyverse.org/). Run `styler::style_file()` to style R and Rmd files
- [ ] Updated relevant unit tests or have written new unit tests - See [Unit Test Guide](https://pharmaverse.github.io/admiral/articles/unit_test_guidance.html)
- [ ] 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)?
- [ ] Update to all relevant roxygen headers and examples.
- [ ] 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)
- [ ] 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)?
- [ ] 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.
- [ ] Run `devtools::document()` so all `.Rd` files in the `man` folder and the `NAMESPACE` file in the project root are updated appropriately
- [ ] Address any updates needed for vignettes and/or templates
- [ ] 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)
- [ ] 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.
- [ ] 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.
- [ ] Address or fix all lintr warnings and errors - `lintr::lint_package()`
- [ ] Run `R CMD check` locally and address all errors and warnings - `devtools::check()`
- [ ] Link the issue so that it closes after successful merging.
- [ ] Address all merge conflicts and resolve appropriately.
- [ ] Link the issue in the Development Section on the right hand side.
- [ ] Address all merge conflicts and resolve appropriately
- [ ] Pat yourself on the back for a job well done! Much love to your accomplishment!
18 changes: 10 additions & 8 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/style.yml@main
if: github.event_name == 'pull_request'
with:
r-version: $R_VERSION
r-version: "4.0"
spellcheck:
name: Spelling
uses: pharmaverse/admiralci/.github/workflows/spellcheck.yml@main
if: github.event_name == 'pull_request'
with:
r-version: $R_VERSION
r-version: "4.0"
readme:
name: Render README
uses: pharmaverse/admiralci/.github/workflows/readme-render.yml@main
if: github.event_name == 'push'
with:
r-version: $R_VERSION
r-version: "4.0"
validation:
name: Validation
uses: pharmaverse/admiralci/.github/workflows/r-pkg-validation.yml@main
if: github.event_name == 'release'
with:
r-version: $R_VERSION
r-version: "4.0"
check:
name: Check
uses: pharmaverse/admiralci/.github/workflows/r-cmd-check.yml@main
Expand All @@ -73,17 +73,19 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/pkgdown.yml@main
if: github.event_name == 'push'
with:
r-version: $R_VERSION
r-version: "4.0"
# Whether to skip multiversion docs
# Note that if you have multiple versions of docs,
# your URL links are likely to break due to path changes
skip-multiversion-docs: false
# Ref to use for the multiversion docs landing page
multiversion-docs-landing-page: devel
linter:
name: Lint
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main
if: github.event_name == 'pull_request'
with:
r-version: $R_VERSION
r-version: "4.0"
links:
name: Links
uses: pharmaverse/admiralci/.github/workflows/links.yml@main
Expand All @@ -95,7 +97,7 @@ jobs:
if: >
github.event_name == 'push' || github.event_name == 'pull_request'
with:
r-version: $R_VERSION
r-version: "4.0"
# Whether to skip code coverage badge creation
# Setting to 'false' will require you to create
# an orphan branch called 'badges' in your repository
Expand All @@ -105,4 +107,4 @@ jobs:
uses: pharmaverse/admiralci/.github/workflows/man-pages.yml@main
if: github.event_name == 'pull_request'
with:
r-version: $R_VERSION
r-version: "4.0"
32 changes: 18 additions & 14 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
Package: admiraldev
Type: Package
Title: Development Tools for the Admiral Package Family
Version: 0.1.0
Version: 0.2.0
Authors@R: c(
person("Ben", "Straub", email = "[email protected]", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut"),
person("Thomas", "Neitmann", role = "aut"),
person("Samia", "Kabi", role = "aut"),
person("Pooja", "Kumari", role = "aut"),
person("Syed", "Mubasheer", role = "aut"),
person("Ross", "Farrugia", role = "aut"),
person("Sadchla", "Mascary", role = "aut"),
person("Zelos", "Zhu", role = "aut"),
person("Jeffrey", "Dickinson", role = "aut"),
person("Ania", "Golab", role = "aut"),
person("Ondrej", "Slama", role = "ctb"),
person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")),
person("GlaxoSmithKline LLC", role = c("cph", "fnd"))
)
Description: Utility functions to check data, variables and conditions for functions used in
'admiral' and 'admiral' extension packages. Additional utility helper functions to to assist developers
'admiral' and 'admiral' extension packages. Additional utility helper functions to assist developers
with maintaining documentation, testing and general upkeep of 'admiral' and 'admiral' extension packages.
License: Apache License (>= 2)
URL: https://pharmaverse.github.io/admiraldev/main/, https://github.com/pharmaverse/admiraldev/
Encoding: UTF-8
Language: en-US
LazyData: false
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1
Depends: R (>= 3.5)
Imports:
assertthat,
dplyr,
lubridate,
magrittr,
purrr,
rlang,
stringr,
hms,
tidyr,
tidyselect,
lifecycle
dplyr (>= 0.8.4),
hms (>= 0.5.3),
lifecycle (>= 0.1.0),
lubridate (>= 1.7.4),
magrittr (>= 1.5),
purrr (>= 0.3.3),
rlang (>= 0.4.4),
stringr (>= 1.4.0),
tidyr (>= 1.0.2),
tidyselect (>= 1.0.0)
Suggests:
admiral.test,
devtools,
Expand Down
23 changes: 8 additions & 15 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

export("%notin%")
export("%or%")
export(add_suffix_to_vars)
export(anti_join)
export(arg_name)
export(as_name)
export(assert_atomic_vector)
export(assert_character_scalar)
export(assert_character_vector)
export(assert_data_frame)
export(assert_date_var)
export(assert_date_vector)
export(assert_expr)
export(assert_filter_cond)
export(assert_function)
Expand All @@ -24,14 +27,15 @@ export(assert_one_to_one)
export(assert_order_vars)
export(assert_param_does_not_exist)
export(assert_s3_class)
export(assert_same_type)
export(assert_symbol)
export(assert_unit)
export(assert_vars)
export(assert_varval_list)
export(backquote)
export(contains_vars)
export(convert_dtm_to_dtc)
export(dataset_vignette)
export(desc)
export(dquote)
export(enumerate)
export(expect_dfs_equal)
Expand All @@ -44,37 +48,24 @@ export(get_new_tmp_var)
export(get_source_vars)
export(inner_join)
export(is_auto)
export(is_date)
export(is_named)
export(is_order_vars)
export(is_timeunit)
export(is_valid_date_entry)
export(is_valid_day)
export(is_valid_dtc)
export(is_valid_hour)
export(is_valid_month)
export(is_valid_sec_min)
export(is_valid_time_entry)
export(left_join)
export(negate_vars)
export(quo_c)
export(quo_not_missing)
export(remove_tmp_vars)
export(replace_symbol_in_quo)
export(replace_values_by_names)
export(set_dataset)
export(squote)
export(suppress_warning)
export(valid_time_units)
export(vars)
export(vars2chr)
export(warn_if_incomplete_dtc)
export(warn_if_inconsistent_list)
export(warn_if_invalid_dtc)
export(warn_if_vars_exist)
export(what_is_it)
importFrom(assertthat,"on_failure<-")
importFrom(assertthat,assert_that)
importFrom(assertthat,is.number)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
Expand Down Expand Up @@ -172,6 +163,7 @@ importFrom(rlang,is_logical)
importFrom(rlang,is_quosure)
importFrom(rlang,is_quosures)
importFrom(rlang,is_symbol)
importFrom(rlang,missing_arg)
importFrom(rlang,new_formula)
importFrom(rlang,parse_expr)
importFrom(rlang,parse_exprs)
Expand All @@ -195,6 +187,7 @@ importFrom(stringr,str_c)
importFrom(stringr,str_detect)
importFrom(stringr,str_extract)
importFrom(stringr,str_glue)
importFrom(stringr,str_match)
importFrom(stringr,str_remove)
importFrom(stringr,str_remove_all)
importFrom(stringr,str_replace)
Expand Down
35 changes: 30 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# admiraldev 0.2.0

## New Features
- Developer addin for formatting tests to admiral programming standards (#73)
- New functions `replace_symbol_in_quo()` and `add_suffix_to_vars()` (#106)
- New function `assert_atomic_vector()` (#98)
- New keyword/family `create_aux` for functions creating auxiliary datasets (#126)
- New function `assert_date_vector()` (#129)
- New function `assert_same_type()` (#176)
- Remove dependency on `{assertthat}` (#149)
- Test coverage for `admiraldev` have increased from 45% to approximately 100% (#94, #95, #96, #98, #101, #103)
- _Environment_ objects were consolidated into a single `admiraldev_environment` object under `R/admiraldev_environment.R`. (#179)

## Updates of Existing Functions
- `expect_names` argument added to `assert_vars()` to check if all variables are named (#117)
- Remove `dplyr` function exports and migration of user facing function `negate_vars()` to admiral (#83)

## Breaking Changes
- No longer compatible with admiral (<0.9)

## Documentation
- New vignette for our package release strategy (#79)
- Updated multiple roxygen headers (#116, #133, #134, #141, #145, #172)
- Description on how admiral options work for certain function inputs, i.e `subject_keys` (#133)

## Various
- PR Checklist Template updated (#172)
- New authors/contributors (#158)

# admiraldev 0.1.0

## New Features
Expand All @@ -7,18 +36,14 @@
- New `{admiraldev}` website created

## Updates of Existing Functions

- NA

## Breaking Changes

- NA

## Documentation

- NA

## Various

- NA

22 changes: 15 additions & 7 deletions R/addin_format_testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ prepare_test_that_file <- function(path) {
}

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

# get file content
file_content <- readLines(path)
Expand Down Expand Up @@ -47,21 +47,29 @@ prepare_test_that_file <- function(path) {
)
test_that_desc_cleaned <- stringr::str_remove(
string = test_that_desc_parsed,
pattern = paste0(testing_fun, ", ", "test \\d{1,}: ")
pattern = paste0("([\\w\\.]+,? )?[Tt]est \\d{1,} ?: ")
)

# determine name of function which is tested
# the function name can be specified by # function_name ---- comments
function_name <- str_match(file_content, "# ([\\w\\.]+) ----")[, 2]
if (is.na(function_name[1])) {
function_name[1] <- testing_file
}
function_name <- tidyr::fill(data.frame(name = function_name), name)$name
function_name <- function_name[test_that_loc]

# formulate new test descriptions (update only those that don't include test_title)
new_desc <- paste0(
testing_fun, ", ",
"test ", seq_along(test_that_loc), ": ",
"Test ", seq_along(test_that_loc), ": ",
test_that_desc_cleaned
)

# insert new test descriptions into test_that lines
test_that_lines_updated <- stringr::str_replace(
string = test_that_lines,
pattern = '(?<=test_that\\(").*"',
replacement = paste0(new_desc, '"')
replacement = paste0(function_name, " ", new_desc, '"')
)

# modify the file content
Expand All @@ -72,10 +80,10 @@ prepare_test_that_file <- function(path) {
####

# formulate headers according to RStudio editor functionality
headers <- paste0("# ---- ", new_desc, " ----")
headers <- paste0("## ", new_desc, " ----")

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

# remove those headers
file_content <- file_content[!header_loc_lgl]
Expand Down
9 changes: 4 additions & 5 deletions R/admiraldev-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @importFrom magrittr %>%
#' @importFrom rlang := abort arg_match as_function as_label as_string call2 caller_env
#' call_name current_env .data enexpr enquo eval_bare eval_tidy expr
#' expr_interp expr_label f_lhs f_rhs inform
#' expr_interp expr_label f_lhs f_rhs inform missing_arg
#' is_bare_formula is_call is_character is_formula is_integerish
#' is_logical is_quosure is_quosures is_symbol new_formula
#' parse_expr parse_exprs quo quo_get_expr quo_is_call
Expand All @@ -15,10 +15,9 @@
#' @importFrom utils capture.output str
#' @importFrom purrr map map2 map_chr map_lgl reduce walk keep map_if transpose
#' flatten every modify_at modify_if reduce compose
#' @importFrom stringr str_c str_detect str_extract str_remove str_remove_all
#' str_replace str_trim str_to_lower str_subset str_to_title str_to_upper
#' str_glue
#' @importFrom assertthat assert_that is.number on_failure<-
#' @importFrom stringr str_c str_detect str_extract str_glue str_match
#' str_remove str_remove_all str_replace str_trim str_to_lower str_subset
#' str_to_title str_to_upper
#' @importFrom lubridate as_datetime ceiling_date date days duration floor_date is.Date is.instant
#' time_length %--% ymd ymd_hms weeks years hours minutes
#' @importFrom tidyr drop_na nest pivot_longer pivot_wider unnest
Expand Down
Loading

0 comments on commit f247139

Please sign in to comment.