We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7f13fa5 commit a19a596Copy full SHA for a19a596
pre_commit/languages/r.py
@@ -107,11 +107,13 @@ def install_environment(
107
'renv::activate("', file.path(getwd()), '"); '
108
)
109
writeLines(activate_statement, 'activate.R')
110
- is_package <- tryCatch({{
111
- content_desc <- read.dcf(file.path(prefix_dir, 'DESCRIPTION'))
112
- suppressWarnings(unname(content_desc[,'Type']) == "Package")
113
- }},
114
- error = function(...) FALSE
+ is_package <- tryCatch(
+ {{
+ path_desc <- file.path(prefix_dir, 'DESCRIPTION')
+ suppressWarnings(desc <- read.dcf(path_desc))
+ "Package" %in% colnames(desc)
115
+ }},
116
+ error = function(...) FALSE
117
118
if (is_package) {{
119
renv::install(prefix_dir)
0 commit comments