precommit
precommit copied to clipboard
Environment setup fails due to a hardcoded snapshot RSPM link in renv.lock
Before filing a bug
- [x] I have installed the latest dev version of {precommit} with
remotes::install_github('lorenzwalthert/precommit') - [x] I have installed the latest hook revisions (update with
precommit::autoupdate()) - [x] I have installed the latest release of the upstream Python framework pre-comit as described under the update instructions.
Describe the bug
Currently, RSPM inside renv.lock uses a snapshot URL:
https://github.com/lorenzwalthert/precommit/blob/efaa00a02f26ec310ef83d45d1d0e21db73d4473/renv.lock#L4-L9
This means that packages released on CRAN after March 29th break hook environment setup. In my case the package is {box.linters}.
Logs (click to expand)
[INFO] Initializing environment for https://github.com/lorenzwalthert/precommit:box.linters.
[INFO] Installing environment for https://github.com/lorenzwalthert/precommit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/usr/local/bin/Rscript', '--no-save', '--no-restore', '--no-site-file', '--no-environ', '/var/folders/lh/y7zmk_td7nzfjxxqxdwhy5r40000gn/T/tmplcuw405r/script.R', 'box.linters')
return code: 1
stdout: (none)
stderr:
Error: package 'box.linters' is not available
In addition: Warning message:
package 'box.linters' is not available from MRAN
Traceback (most recent calls last):
7: renv::install(commandArgs(trailingOnly = TRUE))
6: retrieve(names(remotes))
5: handler(package, renv_retrieve_impl(package))
4: renv_retrieve_impl(package)
3: renv_available_packages_latest(package)
2: stopf("package '%s' is not available", package)
1: stop(sprintf(fmt, ...), call. = call.)
Execution halted
Check the log at /Users/tymek/.cache/pre-commit/pre-commit.log
To Reproduce
- Use the following
.pre-commit-config.yaml:repos: - repo: https://github.com/lorenzwalthert/precommit rev: v0.4.2 hooks: - id: roxygenize additional_dependencies: - box.linters - Run
pre-commit run --all-files
Expected behavior The environment gets successfully set up and the hook runs