
Reclassify Forbidden Notes as Errors in rcmdcheck Results
Source:R/core_metrics.R
check_forbidden_notes.RdThis internal helper function scans the `notes` field of an `rcmdcheck` result object for specific patterns that indicate more serious issues. If any of these patterns are found, the corresponding notes are reclassified as errors by moving them from the `notes` field to the `errors` field.
Value
A modified version of `res_check` where certain notes matching forbidden patterns are moved to the `errors` field.
Examples
# \donttest{
pkg_name <- "foo"
res_check <- list(
notes = c("'foo' import not declared from: 'bar'",
"Namespace in Imports field not imported from: 'baz'",
"no visible global function definition for 'qux'",
"some harmless note"),
warnings = character(0),
errors = character(0)
)
updated <- check_forbidden_notes(res_check, pkg_name)
print(updated$errors) # Should include the first three notes
#> [1] "'foo' import not declared from: 'bar'"
#> [2] "Namespace in Imports field not imported from: 'baz'"
#> [3] "no visible global function definition for 'qux'"
print(updated$notes) # Should include only the harmless note
#> [1] "some harmless note"
# }