Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Release (v3.1.1) #796

Merged
merged 61 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
178d35d
update
narayanan-iyer-pfizer Apr 22, 2024
687dfd4
update
narayanan-iyer-pfizer Apr 22, 2024
56df0cc
update
narayanan-iyer-pfizer May 14, 2024
252f7ad
update
narayanan-iyer-pfizer May 14, 2024
7661238
Merge branch 'ni-644-autonavigation' of https://github.com/pharmaR/ri…
narayanan-iyer-pfizer May 14, 2024
397f5ad
add navigation controls
narayanan-iyer-pfizer May 14, 2024
bca68f9
Re-build manifest file
actions-user May 14, 2024
cea4988
update
narayanan-iyer-pfizer Apr 22, 2024
5bf1179
update
narayanan-iyer-pfizer May 14, 2024
7a83009
update
narayanan-iyer-pfizer May 14, 2024
866c059
update
narayanan-iyer-pfizer Apr 22, 2024
6305885
add js to create and update search index
narayanan-iyer-pfizer May 14, 2024
d2d9460
add navigation controls
narayanan-iyer-pfizer May 14, 2024
d370356
Add navigation in function explorer
actions-user May 14, 2024
51dbe07
Merge branch 'ni-644-autonavigation' of https://github.com/pharmaR/ri…
narayanan-iyer-pfizer Jun 11, 2024
fd2cd34
Add navigation to function explorer
narayanan-iyer-pfizer Jun 11, 2024
4820531
Re-build manifest file
actions-user Jun 12, 2024
2c6c0b7
Initialize developmental version 3.1.0.9000
jthompson-arcus Jun 26, 2024
fc56446
Merge branch 'master' into dev
jthompson-arcus Jun 26, 2024
0e3aef7
Merge branch 'master' into dev
jthompson-arcus Jul 2, 2024
edfec92
Resolve merge conlict with `dev`
jthompson-arcus Jul 3, 2024
c0ddf6b
update code to handle help pages
narayanan-iyer-pfizer Jul 8, 2024
a360341
Update DESCRIPTION
jthompson-arcus Jul 8, 2024
e6d8f8f
Re-build manifest file
actions-user Jul 8, 2024
10690d0
Merge pull request #779 from pharmaR/ni-644-autonavigation
jthompson-arcus Jul 8, 2024
ffb1dad
fix bug crashing the app on pkg deps for pkgs with no dep information.
aclark02-arcus Jul 8, 2024
c92797c
fixed issue with 'package object not found'
aclark02-arcus Jul 8, 2024
b03f3b8
Increment version number to 3.1.0.9002
aclark02-arcus Jul 8, 2024
3a32aec
update news
aclark02-arcus Jul 8, 2024
147bf34
Re-build manifest file
actions-user Jul 8, 2024
13d3cb6
Increment version number to 3.1.1
aclark02-arcus Jul 9, 2024
7386c15
reword news file
aclark02-arcus Jul 9, 2024
bd26668
Merge branch 'ac-802' of https://github.com/pharmaR/riskassessment in…
aclark02-arcus Jul 9, 2024
a1aafcc
Re-build manifest file
actions-user Jul 9, 2024
f2e3ff0
remove redunant code
aclark02-arcus Jul 9, 2024
c7b0ec2
Merge branch 'ac-802' of https://github.com/pharmaR/riskassessment in…
aclark02-arcus Jul 9, 2024
32c3137
Re-build manifest file
actions-user Jul 9, 2024
bd8001c
Merge pull request #803 from pharmaR/ac-802
jthompson-arcus Jul 9, 2024
4035e6e
Correctly parse `riskmetric` dependency assessment
jthompson-arcus Jul 9, 2024
f46c703
Update NEWS
jthompson-arcus Jul 9, 2024
d2c3900
Re-build manifest file
actions-user Jul 9, 2024
14f5e97
Access new token
jthompson-arcus Jul 9, 2024
d7bcdf3
Try newer workflow
jthompson-arcus Jul 10, 2024
b226994
Re-build manifest file
actions-user Jul 10, 2024
934df7d
Add `available_packages_filters` to session options
jthompson-arcus Jul 10, 2024
caa65e2
Properly reset option on stopping application
jthompson-arcus Jul 10, 2024
39eed4d
Merge pull request #806 from pharmaR/jt-805-zero_dependencies
aclark02-arcus Jul 10, 2024
67bc4f4
Merge branch 'dev' into jt-800-fix_codecov
aclark02-arcus Jul 10, 2024
df1813b
Merge pull request #807 from pharmaR/jt-800-fix_codecov
aclark02-arcus Jul 10, 2024
ff7628e
Merge branch 'dev' into jt-776-fix_avaiable_pkg_lst
jthompson-arcus Jul 10, 2024
67b7852
Update NEWS
jthompson-arcus Jul 10, 2024
80833c9
Re-build manifest file
actions-user Jul 10, 2024
ed016fc
Merge pull request #808 from pharmaR/jt-776-fix_avaiable_pkg_lst
aclark02-arcus Jul 11, 2024
1c4451e
Remove evaluation recording from riskmetric assessments
jthompson-arcus Aug 2, 2024
243754e
Merge branch 'dev' into jt-rm_with_eval_recording
jthompson-arcus Aug 5, 2024
dcb0728
Update NEWS
jthompson-arcus Aug 5, 2024
3148426
Merge pull request #810 from pharmaR/jt-rm_with_eval_recording
aclark02-arcus Aug 5, 2024
db35932
Check for tarball directory before returning from `initialize_raa()`
jthompson-arcus Aug 5, 2024
7ab8821
Update NEWS
jthompson-arcus Aug 5, 2024
1265f76
Re-build manifest file
actions-user Aug 5, 2024
b04110a
Merge pull request #813 from pharmaR/jt-tarball_directory_creation
aclark02-arcus Aug 5, 2024
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
42 changes: 34 additions & 8 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand All @@ -9,6 +9,8 @@ on:

name: test-coverage

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
Expand All @@ -24,21 +26,45 @@ jobs:
sudo apt-get update
sudo apt-get install -y texlive-xetex

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
use-public-rspm: false
r-version: 'renv'

- uses: r-lib/actions/setup-renv@v2

- name: Install riskassessment
shell: bash
run: R CMD INSTALL --preclean .

- name: Test coverage
run: covr::codecov()
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: riskassessment
Title: A web app designed to interface with the `riskmetric` package
Version: 3.1.0
Version: 3.1.1
Authors@R: c(
person("Aaron", "Clark", role = c("aut", "cre"), email = "clark.aaronchris@gmail.com"),
person("Jeff", "Thompson", role = c("aut"), email = "jeff.thompson51317@gmail.com", comment = "Co-Lead"),
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# riskassessment 3.1.1

* Added navigation controls in Function Explorer tab (#644)
* Fixed bug that crashed the Package Dependencies page for pkgs without any dependency info available (#802)
* Fixed bug that incorrectly displayed 0 dependencies as 1 (#805)
* Fixed bug that kept full list of available packages from populating (#776)
* Removed `.recording` attribute from `riskmetric` assessments for storage purposes
* Ensured `tarballs` directory existed before returning from `initialize_raa()`

# riskassessment 3.1.0

### User Enhancements
Expand Down
17 changes: 14 additions & 3 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@ app_server <- function(input, output, session) {

old <- options()
onStop(function() {
options(old)
})
options(repos = get_db_config("package_repo"))
options(c(
# Unsets available packages filter if unset previously. Will be overriden
# otherwise.
list(available_packages_filters = NULL),
old
))
})
options(
# Set session repo to value specified in configuration file
repos = get_db_config("package_repo"),
# Removes filters based on R version, OS type, sub-architecture. Only
# duplicates will be removed from the available package list
available_packages_filters = "duplicates"
)

# Collect user info.
user <- reactiveValues()
Expand Down
83 changes: 79 additions & 4 deletions R/mod_code_explorer.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod_code_explorer_server <- function(id, selected_pkg, pkgarchive = reactiveVal(
showHelperMessage(message = glue::glue("Source code not available for {{{selected_pkg$name()}}}"))
} else {
div(introJSUI(NS(id, "introJS")),
br(),
br(),
fluidRow(
column(3,
wellPanel(
Expand Down Expand Up @@ -69,7 +69,28 @@ mod_code_explorer_server <- function(id, selected_pkg, pkgarchive = reactiveVal(
div(id = ns("file_viewer"),
uiOutput(ns("file_output"), class = "file_browser"),
style = "height: 62vh; overflow: auto; border: 1px solid var(--bs-border-color-translucent);"
)
),
br(),
fluidRow(style = "height:35px !important;",
column(4,offset = 8,
conditionalPanel(
condition = "typeof(window.$highlights_list) != 'undefined' && window.$highlights_list.length > 1",
actionButton(ns("prev_button"),label = "",icon = icon("chevron-left"),
style ="width: 32px !important;
height: 32px !important;
font-size: 16px !important;
line-height: 5px !important;
padding: 0px !important;") |>bslib::tooltip("Previous occurence"), style = "display: inline-block;",

div(id = "search_index","",style ="display:inline"),
actionButton(ns("next_button"),label = "",icon = icon("chevron-right"),
style = "width: 32px !important;
height: 32px !important;
font-size: 16px !important;
line-height: 5px !important;
padding: 0px !important;
display:inline;
")|>bslib::tooltip("Next occurence",placement ="right"), style = "display: inline-block;")))
)
),
br(), br(),
Expand Down Expand Up @@ -127,7 +148,7 @@ mod_code_explorer_server <- function(id, selected_pkg, pkgarchive = reactiveVal(
close(con)
func_list <- c(input$exported_function, paste0("`", input$exported_function, "`"))
highlight_index <- parse_data() %>%
filter(stringr::str_ends(file, input$test_files) & func %in% func_list) %>%
filter(basename(file) == input$test_files & func %in% func_list) %>%
pull(line)
renderCode(lines, highlight_index)
}) %>%
Expand All @@ -144,7 +165,7 @@ mod_code_explorer_server <- function(id, selected_pkg, pkgarchive = reactiveVal(
close(con)
func_list <- c(input$exported_function, paste0("`", input$exported_function, "`"))
highlight_index <- parse_data() %>%
filter(stringr::str_ends(file, input$source_files) & func %in% func_list) %>%
filter(basename(file) == input$source_files & func %in% func_list) %>%
pull(line)
renderCode(lines, highlight_index)
}) %>%
Expand All @@ -157,16 +178,70 @@ mod_code_explorer_server <- function(id, selected_pkg, pkgarchive = reactiveVal(
con <- archive::archive_read(file.path("tarballs",
glue::glue("{selected_pkg$name()}_{selected_pkg$version()}.tar.gz")),
file = fp)

Rdfile <-tools::parse_Rd(con)
close(con)
shinyjs::runjs('
$highlights_list = undefined;')

HTML(paste0(utils::capture.output(tools::Rd2HTML(Rdfile,
package = c(selected_pkg$name(),
selected_pkg$version()), out = "")), collapse = "\n"))
}) %>%
bindEvent(input$man_files, input$exported_function, ignoreNULL = FALSE)

introJSServer("introJS", text = reactive(fe_steps), user, credentials)
search_index_value <- reactiveVal(1)
highlight_list <- reactiveVal(1)

observeEvent(input$next_button,{
if (input$next_button > 0){
shinyjs::runjs('
var $index =Array.from($highlights_list).findIndex(node => node.isEqualNode($curr_sel));
if( $index == $highlights_list.length -1)
{

$curr_sel = $highlights_list[0]
search_index.innerHTML = 1 + " of " + $highlights_list.length;

}
else
{
$curr_sel = $highlights_list[$index +1]
search_index.innerHTML = ( $index+2) + " of " + $highlights_list.length;
}

var $target = document.querySelector("#code_explorer-file_viewer")
$target.scrollTop = 0;
$target.scrollTop =$curr_sel.offsetTop -40; ')

}

})

observeEvent(input$prev_button,{
if (input$prev_button > 0){

shinyjs::runjs('var $index =Array.from($highlights_list).findIndex(node => node.isEqualNode($curr_sel));
if( $index ==0)
{
$curr_sel = $highlights_list[$highlights_list.length -1]
search_index.innerHTML = $highlights_list.length + " of " + $highlights_list.length;
}
else
{
$curr_sel = $highlights_list[$index -1]
search_index.innerHTML = ($index) + " of " + $highlights_list.length;
}
var $target = document.querySelector("#code_explorer-file_viewer")

$target.scrollTop = 0;
$target.scrollTop = $curr_sel.offsetTop - 40;

')
}

})
output$file_output <- renderUI({
switch (input$file_type,
test = test_code(),
Expand Down
10 changes: 10 additions & 0 deletions R/mod_code_explorer_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,19 @@ renderCode <- function(lines, hlindex) {
})
),
tags$script(HTML("

document.querySelectorAll('.code pre').forEach(bl => {
hljs.highlightBlock(bl);
});
var $highlights_list = document.querySelectorAll('.highlight')
var $curr_sel = document.querySelector('.highlight')
if(typeof($highlights_list) != 'undefined' & $curr_sel != null){
var $target = document.querySelector('#code_explorer-file_viewer')
$target.scrollTop = 0;
$target.scrollTop = $curr_sel.offsetTop - 40;
var $index1 =Array.from($highlights_list).findIndex(node => node.isEqualNode($curr_sel)) +1;
search_index.innerHTML = $index1 + ' of ' + $highlights_list.length;
}
"))
)
}
8 changes: 4 additions & 4 deletions R/mod_packageDependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ packageDependenciesServer <- function(id, selected_pkg, user, credentials, paren
req(pkgref())
tryCatch(
expr = {
deep_ends <- pkgref()$dependencies[[1]] %>% dplyr::as_tibble() %>%
deep_ends <- {if(suppressWarnings(is.null(nrow(pkgref()$dependencies[[1]])) || nrow(pkgref()$dependencies[[1]]) == 0)) dplyr::tibble(package = character(0), type = character(0)) else pkgref()$dependencies[[1]] %>% dplyr::as_tibble()} %>%
mutate(package = stringr::str_replace(package, "\n", " ")) %>%
mutate(name = stringr::str_extract(package, "^((([[A-z]]|[.][._[A-z]])[._[A-z0-9]]*)|[.])"))

Expand Down Expand Up @@ -94,7 +94,8 @@ packageDependenciesServer <- function(id, selected_pkg, user, credentials, paren
)
tryCatch(
expr = {
shrug_jests <- pkgref()$suggests[[1]] %>% dplyr::as_tibble()%>%
shrug_jests <-
{if(suppressWarnings(is.null(nrow(pkgref()$suggests[[1]])) || nrow(pkgref()$suggests[[1]]) == 0)) dplyr::tibble(package = character(0), type = character(0)) else pkgref()$suggests[[1]] %>% dplyr::as_tibble()} %>%
mutate(package = stringr::str_replace(package, "\n", " ")) %>%
mutate(name = stringr::str_extract(package, "^((([[A-z]]|[.][._[A-z]])[._[A-z0-9]]*)|[.])"))

Expand Down Expand Up @@ -122,8 +123,7 @@ packageDependenciesServer <- function(id, selected_pkg, user, credentials, paren
decision_id = character(0)))
}
)
# this is so the dependencies is also a 0x2 tibble like suggests
if (rlang::is_empty(pkgref()$dependencies[[1]])) depends(dplyr::tibble(package = character(0), type = character(0), name = character(0)))


revdeps(pkgref()$reverse_dependencies[[1]] %>% as.vector())

Expand Down
1 change: 0 additions & 1 deletion R/utils_build_cards.R
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ build_dep_cards <- function(data, loaded, toggled){
is_url = numeric(),
type = character()
)


deps <- data %>%
mutate(base = if_else(name %in% c(rownames(installed.packages(priority = "base"))), "Base", "Non-Base")) %>%
Expand Down
72 changes: 37 additions & 35 deletions R/utils_get_db.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,42 @@ get_metric_data <- function(pkg_name, metric_class = 'maintenance', db_name = go
)
}

#' Get Dependency Pkg Versions and Scores
#'
#'
#' @param pkg_name character name of the package
#' @param verify_data a data.frame used to verify whether a pkg exists in the db
#' @param cran_pkgs a data.frame containing all available cran package names/versions
#'
#' @returns a list
#' @noRd
get_versnScore <- function(pkg_name, verify_data, cran_pkgs) {

if (rlang::is_empty(pkg_name))
return(list(name = character(), version = character(), score = character(),
decision_id = character(), decision = character()))

if (pkg_name %in% verify_data$name) { #loaded2_db()$name
tmp_df <- verify_data %>% filter(name == pkg_name) %>% select(score, version, decision_id, decision)
pkg_score <- tmp_df %>% pull(score) %>% as.character
pkg_versn <- tmp_df %>% pull(version) %>% as.character
pkg_decision_id <- tmp_df %>% pull(decision_id) %>% as.character
pkg_decision <- tmp_df %>% pull(decision) %>% as.character
} else {
pkg_score <- ""
pkg_versn <- if_else(pkg_name %in% c(rownames(installed.packages(priority="base"))), "",
subset(cran_pkgs, Package == pkg_name, c("Version")) %>% as.character())
pkg_decision_id <- ""
pkg_decision <- ""
}

return(list(name = pkg_name, version = pkg_versn, score = pkg_score,
decision_id = pkg_decision_id, decision = pkg_decision
))
}



#' The 'Get Dependencies Metrics Data' function
#'
#' Pull the depenencies data for a specific package id, and create
Expand Down Expand Up @@ -277,7 +313,7 @@ get_depends_data <- function(pkg_name,
deps_decision_data <- purrr::map_df(deep_ends$name, ~get_versnScore(.x, loaded2_db, repo_pkgs))
if(nrow(deps_decision_data) == 0) {
deps_w_decision <- dplyr::tibble(name = character(0), version = character(0),
score = character(0), decision = character(0), decision_id = character(0))
score = character(0), decision = character(0), decision_id = character(0))
} else {
deps_w_decision <- deps_decision_data
}
Expand Down Expand Up @@ -407,40 +443,6 @@ get_assess_blob <- function(pkg_lst, db_name = golem::get_golem_options('assessm
}


#' Get Dependency Pkg Versions and Scores
#'
#'
#' @param pkg_name character name of the package
#' @param verify_data a data.frame used to verify whether a pkg exists in the db
#' @param cran_pkgs a data.frame containing all available cran package names/versions
#'
#' @returns a list
#' @noRd
get_versnScore <- function(pkg_name, verify_data, cran_pkgs) {

if (rlang::is_empty(pkg_name))
return(list(name = character(), version = character(), score = character(),
decision_id = character(), decision = character()))

if (pkg_name %in% verify_data$name) { #loaded2_db()$name
tmp_df <- verify_data %>% filter(name == pkg_name) %>% select(score, version, decision_id, decision)
pkg_score <- tmp_df %>% pull(score) %>% as.character
pkg_versn <- tmp_df %>% pull(version) %>% as.character
pkg_decision_id <- tmp_df %>% pull(decision_id) %>% as.character
pkg_decision <- tmp_df %>% pull(decision) %>% as.character
} else {
pkg_score <- ""
pkg_versn <- if_else(pkg_name %in% c(rownames(installed.packages(priority="base"))), "",
subset(cran_pkgs, Package == pkg_name, c("Version")) %>% as.character())
pkg_decision_id <- ""
pkg_decision <- ""
}

return(list(name = pkg_name, version = pkg_versn, score = pkg_score,
decision_id = pkg_decision_id, decision = pkg_decision
))
}



##### End of get_* functions #####
Expand Down
Loading
Loading