Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ rsconnect/

*.docx
docs
.DS_Store
.quarto
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: assertHE
Title: Visualisation and Verification of Health Economic Decision Models
Version: 1.0.0.9000
Version: 1.0.1
Authors@R: c(
person("Robert", "Smith", , "rsmith@darkpeakanalytics.com", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0003-0245-3217")),
Expand All @@ -19,7 +19,7 @@ Description: Designed to help health economic modellers when building and review
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
Suggests:
testthat (>= 3.0.0),
colourpicker,
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# assertHE (development version)
# assertHE 1.0.1

* Fixes issue arising from `dplyr` updates. `dplyr` recently removed `dplyr::location()`. `assertHE` referenced a column named `location` but does not note this as a global variable with `utils::globalVariables("location")` which did not cause an issue because `dplyr` was exporting a function with the same name `location()`.
* Unifies coverage percentage where test location/folder is `NA`.

# assertHE 1.0.0

Expand Down
21 changes: 17 additions & 4 deletions R/project_visualiser.R
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,13 @@ plotNetwork <- function(df_edges,
)
),
"<br><b>Coverage</b>: ",
paste0(df_node_info$coverage[index] * 100, "%")
paste0(
ifelse(
test = is.na(df_node_info$coverage[index]),
yes = paste0(0, "%"),
no = paste0(df_node_info$coverage[index] * 100, "%")
)
)
)
}
} else {
Expand All @@ -485,7 +491,13 @@ plotNetwork <- function(df_edges,
no = df_node_info$test_location
),
"<br><b>Coverage</b>: ",
paste0(df_node_info$coverage * 100, "%")
paste0(
ifelse(
test = is.na(df_node_info$coverage),
yes = paste0(0, "%"),
no = paste0(df_node_info$coverage * 100, "%")
)
)
)
}

Expand Down Expand Up @@ -630,8 +642,9 @@ processNodes <- function(df_edges,
unlist(use.names = FALSE) |>
unique() |>
stats::na.omit()
) |>
dplyr::mutate(label = id)
)

df_nodes[["label"]] <- df_nodes$id

return(df_nodes)
}
Expand Down
11 changes: 5 additions & 6 deletions R/test_finder.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @param foo_strings string vector of function names to search for
#' @param filter_for_test_that whether to filter for only functions used after the call to test_that. Default FALSE.
#'
#' @return a dataframe with the columns 'foo' for function name and 'location' which gives
#' @return a dataframe with the columns 'foo' for function name and 'test_location' which gives
#' the file in which the function is called with the line in which the function is called
#' appended.
#'
Expand Down Expand Up @@ -69,10 +69,10 @@ find_function_calls_in_file <- function(relative_path = NULL,
if(nrow(df) == 0) return(NULL)

# combine file path & line number in single string
df$location <- paste0(relative_path, "#L", df$line)
df$test_location <- paste0(relative_path, "#L", df$line)
df$foo_string <- df$text

return(df[, c("foo_string", "location")])
return(df[, c("foo_string", "test_location")])

}

Expand All @@ -85,7 +85,7 @@ find_function_calls_in_file <- function(relative_path = NULL,
#' @param test_folder folder containing all tests
#' @inheritParams find_function_calls_in_file
#'
#' @return dataframe with two columns. 'foo' contains function names, location
#' @return dataframe with two columns. 'foo' contains function names, test_location
#' contains the location of the tests for each function (file and line number).
#' @export
#'
Expand Down Expand Up @@ -131,8 +131,7 @@ find_function_calls_in_folder <- function(test_folder,

# get summary dataframe
df_summary <- dplyr::bind_rows(l_foo_test_paths) |>
as.data.frame() |>
dplyr::rename(test_location = location)
as.data.frame()

# ensure all function inputs are included in dataframe of outputs
df_out <- merge(
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ We are continuing to work to improve the package and welcome contributions. To g

## Installation

You can install the CRAN version of assertHE from [CRAN](https://cran.r-project.org/web/packages/assertHE/) with:
You can install the CRAN version of assertHE from [CRAN](https://CRAN.R-project.org/package=assertHE) with:

``` r
install.packages("assertHE")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ wiki](https://github.com/dark-peak-analytics/assertHE/wiki/assertHE:-an-R-packag
## Installation

You can install the CRAN version of assertHE from
[CRAN](https://cran.r-project.org/web/packages/assertHE/) with:
[CRAN](https://CRAN.R-project.org/package=assertHE) with:

``` r
install.packages("assertHE")
Expand Down
13 changes: 4 additions & 9 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
## R CMD check results

0 errors | 0 warnings | 1 note
── R CMD check results ──────────────────────────────────────── assertHE 1.0.1 ────
Duration: 1m 7.5s

* checking for future file timestamps ... NOTE
checking for future file timestamps ... NOTE
unable to verify current time

* This is a new release.

## Notes on CRAN incoming checks

* CRAN flagged the script R/cheers_checker.R as adapting the Global Environment or using rm(list = ls()). We cannot identify any that modify the Global Environment or use rm(list = ls()). Are you able to advise?

* CRAN flagged the script R/addin_handler.R which defines the RStudio addin as adapting the Global Environment or using rm(list = ls()). We cannot identify any code that modify the Global Environment or use rm(list=ls()). Are you able to advise?
0 errors ✔ | 0 warnings ✔ | 1 note ✖
2 changes: 1 addition & 1 deletion man/find_function_calls_in_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/find_function_calls_in_folder.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-test_finder.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_that(desc = "Check find_function_calls_in_file works for example scripts",
expected_df <-
data.frame(
foo_string = rep("calculate_costs", 2),
location = paste0(relative_path, "#L", c(26, 33))
test_location = paste0(relative_path, "#L", c(26, 33))
)

# run function and store output
Expand Down