7979
8080get_package_addins <- function (pkg ) {
8181 path <- system.file(" rstudio" , " addins.dcf" , package = pkg )
82- if (! nzchar(path )) return (list ())
82+ if (! nzchar(path )) {
83+ return (list ())
84+ }
8385
8486 dcf <- tryCatch(read.dcf(path ), error = function (cnd ) {
85- log_error(sprintf(" Failed to read addins.dcf for '%s': %s" , pkg , conditionMessage(cnd )))
87+ log_error(sprintf(
88+ " Failed to read addins.dcf for '%s': %s" ,
89+ pkg ,
90+ conditionMessage(cnd )
91+ ))
8692 NULL
8793 })
88- if (is.null(dcf )) return (list ())
94+ if (is.null(dcf )) {
95+ return (list ())
96+ }
8997
9098 cols <- colnames(dcf )
9199 out <- lapply(seq_len(nrow(dcf )), function (i ) {
@@ -96,7 +104,9 @@ get_package_addins <- function(pkg) {
96104
97105parse_addin_row <- function (dcf , row , cols , pkg ) {
98106 binding <- dcf_field(dcf , row , " Binding" , cols )
99- if (! nzchar(binding )) return (NULL )
107+ if (! nzchar(binding )) {
108+ return (NULL )
109+ }
100110
101111 list (
102112 name = dcf_field(dcf , row , " Name" , cols ),
@@ -120,7 +130,9 @@ parse_addin_row <- function(dcf, row, cols, pkg) {
120130
121131get_package_templates <- function (pkg ) {
122132 path <- system.file(" rmarkdown" , " templates" , package = pkg )
123- if (! nzchar(path )) return (list ())
133+ if (! nzchar(path )) {
134+ return (list ())
135+ }
124136
125137 dirs <- list.dirs(path , recursive = FALSE , full.names = TRUE )
126138 out <- lapply(dirs , function (dir ) parse_template_dir(dir , pkg ))
@@ -129,13 +141,21 @@ get_package_templates <- function(pkg) {
129141
130142parse_template_dir <- function (dir , pkg ) {
131143 yaml_path <- file.path(dir , " template.yaml" )
132- if (! file.exists(yaml_path )) return (NULL )
144+ if (! file.exists(yaml_path )) {
145+ return (NULL )
146+ }
133147
134148 meta <- tryCatch(yaml :: read_yaml(yaml_path ), error = function (cnd ) {
135- log_error(sprintf(" Failed to read template.yaml at '%s': %s" , yaml_path , conditionMessage(cnd )))
149+ log_error(sprintf(
150+ " Failed to read template.yaml at '%s': %s" ,
151+ yaml_path ,
152+ conditionMessage(cnd )
153+ ))
136154 NULL
137155 })
138- if (is.null(meta )) return (NULL )
156+ if (is.null(meta )) {
157+ return (NULL )
158+ }
139159
140160 list (
141161 name = meta $ name %|| % basename(dir ),
0 commit comments