File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 22files <- commandArgs(trailing = TRUE )
33
44out <- lapply(files , function (path ) {
5+
56 tryCatch(
6- roxygen2 :: parse_file(path , env = NULL ),
7- warning = function (w ) {
8- cat(c(" Roxygen commentary in file " , path , " is not parsable. Full context:\n " ))
9- stop(conditionMessage(w ), call. = FALSE )
10- },
7+ # Capture any messages from roxygen2:::warn_roxy()
8+ msg <- capture.output(
9+ roxygen2 :: parse_file(path , env = NULL ),
10+ type = " message"
11+ ),
12+
13+ # In case we encounter a more general file parsing problem
1114 error = function (e ) {
1215 cat(c(" File " , path , " is not parsable. Full context:\n " ))
1316 stop(conditionMessage(e ), call. = FALSE )
1417 }
1518 )
19+
20+ if (length(msg ) > 0 ) {
21+ cat(c(" Roxygen commentary in file " , path , " is not parsable. Full context:\n " ))
22+ stop(paste0(msg , collapse = " \n " ), call. = FALSE )
23+ }
1624})
You can’t perform that action at this time.
0 commit comments