Skip to content

Commit 5466ad5

Browse files
Merge pull request #413 from mpadge/main
don't presume pre-commit-config exists in ensure_renv_compat
2 parents 6f38f96 + 95ba221 commit 5466ad5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ editor_options:
66

77
# precommit v0.3.0.9000
88

9+
- Fix bug that prevented pkg load outside directories with precommit files
10+
(@mpadge, #413).
911
- hook `forbid-to-commit` in template `.pre-commit-config.yaml` has
1012
now the correct `exclude-files` regular expression to ignore
1113
`.csv`, `.RData`, `.Rds`, `.rds` and `.Rhistory` (#410).

R/setup.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ ensure_renv_precommit_compat <- function(package_version_renv = utils::packageVe
179179
} else {
180180
withr::local_dir(root)
181181
path_config <- ".pre-commit-config.yaml"
182+
if (!file_exists(path_config)) {
183+
return()
184+
}
182185
config_lines <- readLines(path_config, encoding = "UTF-8")
183186
has_renv <- fs::file_exists("renv.lock")
184187
if (!has_renv) {

0 commit comments

Comments
 (0)