Closed kyleam closed 4 months ago
This is due to an NA
value being used in the max_line_char(str_new) > width
condition. The code_file
value may be NA
if the a definition for the export was not found under R/
:
The following change resolves the error when scoring mrgsolve:
diff --git a/R/util.R b/R/util.R
index 3069924..5e8de6d 100644
--- a/R/util.R
+++ b/R/util.R
@@ -162,6 +162,10 @@ wrapi_text <- function(
checkmate::assert_character(str)
checkmate::assert_true(length(str) == 1)
+ if (is.na(str)) {
+ return(str)
+ }
+
str_new <- str
# Get max number of characters per line (splits on '\n')
That seems straightforward enough, but I'd like to include a regression test.
Scoring mrgsolve with mpn.scorecard 0.4.0 fails:
more output
``` [...] scoring /tmp/score-r-pkg-UKn5tw6/mrgsolve_1.4.2.tar.gz... library paths: c("/tmp/score-r-pkg-UKn5tw6/lib", "/opt/R/4.1.3/lib/R/library") rcmdcheck for mrgsolve_1.4.2 passed with warnings and/or notes The following exports were not found in R/ for mrgsolve: filter update tail show plot names length labels head dim c as.numeric as.matrix as.list as.data.frame In package `mrgsolve`, the R scripts (NA, R/generics.R) are missing documentation for the following exports: tail show plot nrow names length labels head dim c as.numeric as.matrix as.list as.data.frame Quitting from lines 88-89 [unnamed-chunk-5] (scorecard-template.Rmd) Error in `dplyr::mutate()` at magrittr/R/pipe.R:136:3: i In argument: `dplyr::across(...)`. Caused by error in `across()`: ! Can't compute column `code_file`. Caused by error in `purrr::map_chr()`: i In index: 49. Caused by error in `if (max_line_char(str_new) > width && isTRUE(strict)) ...`: ! missing value where TRUE/FALSE needed Backtrace: 1. mpn.scorecard:::format_traceability_matrix(params$exports_df) 11. mpn.scorecard:::wrap_text(...) 12. purrr::map_chr(...) 13. purrr:::map_("character", .x, .f, ..., .progress = .progress) at purrr/R/map.R:154:3 17. mpn.scorecard (local) .f(.x[[i]], ...) Execution halted ```The failure does not happen with mpn.scorecard v0.3.0.