@@ -5,7 +5,7 @@ check_options_documentation = function(rd_file) {
55 # Find options in R code
66 walk_for_dt_options = function (expr ) {
77 result = character ()
8- if (is.call(expr ) && length(expr ) > = 2L && identical(expr [[1 ]], quote(getOption )) && is.character(e2 <- expr [[2L ]]) && startsWith(e2 , " datatable." )) {
8+ if (is.call(expr ) && length(expr ) > = 2L && identical(expr [[1L ]], quote(getOption )) && is.character(e2 <- expr [[2L ]]) && startsWith(e2 , " datatable." )) {
99 result = e2
1010 } else if (is.recursive(expr )) {
1111 result = c(result , unlist(lapply(expr , walk_for_dt_options )))
@@ -21,24 +21,25 @@ check_options_documentation = function(rd_file) {
2121 }
2222
2323 # Find options in documentation
24+ walk_rd = function (rd_element ) {
25+ result = character (0 )
26+ if (! is.list(rd_element )) return (character ())
27+ if (isTRUE(attr(rd_element , " Rd_tag" ) == " \\ code" ) && length(rd_element ) > = 1L ) {
28+ content = rd_element [[1L ]]
29+ if (is.character(content ) && startsWith(content , " datatable." )) {
30+ result = content
31+ }
32+ }
33+ c(result , unlist(lapply(rd_element , walk_rd )))
34+ }
2435 get_options_from_doc = function (rd_file ) {
2536 if (! file.exists(rd_file )) return (character (0 ))
26-
27- tryCatch({
28- walk_rd = function (rd_element ) {
29- result = character (0 )
30- if (! is.list(rd_element )) return (character ())
31- if (isTRUE(attr(rd_element , " Rd_tag" ) == " \\ code" ) && length(rd_element ) > = 1L ) {
32- content = rd_element [[1L ]]
33- if (is.character(content ) && startsWith(content , " datatable." )) {
34- result = content
35- }
36- }
37- c(result , unlist(lapply(rd_element , walk_rd )))
38- }
39- found = walk_rd(tools :: parse_Rd(rd_file ))
40- sort(unique(found ))
41- }, error = function (e ) character (0 ))
37+
38+ rd_file | >
39+ tools :: parse_Rd() | >
40+ walk_rd() | >
41+ unique() | >
42+ sort()
4243 }
4344
4445 code_opts = get_options_from_code()
0 commit comments