From 55d522fef6a080f58965175ab6ff339235e33b3f Mon Sep 17 00:00:00 2001 From: Jack Smith Date: Fri, 6 Feb 2026 13:15:10 +0100 Subject: [PATCH] Silence CRAN codetools NOTEs for globals 'id' and 'location' using rlang::.data --- DESCRIPTION | 27 ++++++++++++++------------- NAMESPACE | 1 + R/project_visualiser.R | 9 ++++++++- R/test_finder.R | 9 ++++++++- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8449915..64cb72d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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, @@ -30,22 +30,23 @@ Depends: R (>= 4.1.0) Imports: assertthat, - ggplot2, - dplyr, - utils, - visNetwork, covr, - htmltools, - officer, + dplyr, flextable, + ggplot2, + httr, + htmltools, + igraph, knitr, + methods, + officer, + rlang, + roxygen2, + rstudioapi, shiny, shinyjs, - rstudioapi, - roxygen2, - methods, - waiter, - igraph, - httr + utils, + visNetwork, + waiter URL: https://dark-peak-analytics.github.io/assertHE/, https://github.com/dark-peak-analytics/assertHE BugReports: https://github.com/dark-peak-analytics/assertHE/issues diff --git a/NAMESPACE b/NAMESPACE index 8d5d7e5..7b62ff9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -50,6 +50,7 @@ importFrom(knitr,kable) importFrom(methods,formalArgs) importFrom(officer,body_add_par) importFrom(officer,read_docx) +importFrom(rlang,.data) importFrom(roxygen2,parse_file) importFrom(rstudioapi,navigateToFile) importFrom(stats,na.omit) diff --git a/R/project_visualiser.R b/R/project_visualiser.R index 57f7057..f2460c4 100644 --- a/R/project_visualiser.R +++ b/R/project_visualiser.R @@ -1,3 +1,10 @@ +# This roxygen tag imports the .data pronoun from rlang. +# It allows us to write .data$location / .data$id inside dplyr verbs. +# It silences the common "no visible binding for global variable" NOTES +# from R CMD check / codetools when using data-masking. +#' @importFrom rlang .data +NULL + #' Visualize Project #' #' Visualize the dependencies between functions in a project using a network plot. @@ -631,7 +638,7 @@ processNodes <- function(df_edges, unique() |> stats::na.omit() ) |> - dplyr::mutate(label = id) + dplyr::mutate(label = .data$id) return(df_nodes) } diff --git a/R/test_finder.R b/R/test_finder.R index b5b01de..547da2b 100644 --- a/R/test_finder.R +++ b/R/test_finder.R @@ -1,3 +1,10 @@ +# This roxygen tag imports the .data pronoun from rlang. +# It allows us to write .data$location / .data$id inside dplyr verbs. +# It silences the common "no visible binding for global variable" NOTES +# from R CMD check / codetools when using data-masking. +#' @importFrom rlang .data +NULL + #' Find all function calls in file #' #' Searches through a file for function calls using SYMBOL_FUNCTION_CALL @@ -132,7 +139,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) + dplyr::rename(test_location = .data$location) # ensure all function inputs are included in dataframe of outputs df_out <- merge(