Skip to content

Commit a19a596

Browse files
Use more common package definition
1 parent 7f13fa5 commit a19a596

File tree

1 file changed

+7
-5
lines changed
  • pre_commit/languages

1 file changed

+7
-5
lines changed

pre_commit/languages/r.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ def install_environment(
107107
'renv::activate("', file.path(getwd()), '"); '
108108
)
109109
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
110+
is_package <- tryCatch(
111+
{{
112+
path_desc <- file.path(prefix_dir, 'DESCRIPTION')
113+
suppressWarnings(desc <- read.dcf(path_desc))
114+
"Package" %in% colnames(desc)
115+
}},
116+
error = function(...) FALSE
115117
)
116118
if (is_package) {{
117119
renv::install(prefix_dir)

0 commit comments

Comments
 (0)