Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix language:r hook installation when initiated in RStudio#3389

Merged
asottile merged 1 commit intopre-commit:mainfrom
lorenzwalthert:dev-always-unset-renv
Jan 20, 2025
Merged

Fix language:r hook installation when initiated in RStudio#3389
asottile merged 1 commit intopre-commit:mainfrom
lorenzwalthert:dev-always-unset-renv

Conversation

@lorenzwalthert
Copy link
Contributor

@lorenzwalthertlorenzwalthert commentedJan 19, 2025
edited
Loading

Closes#3385. The bug is that ininstall_environment(), the env patch was not applied in the following snippet:

with_r_code_in_tempfile(r_code_inst_environment)asf:cmd_output_b(_rscript_exec(),'--vanilla',f,cwd=env_dir)

The existing_execute_vanilla_r_code_as_script() abstracting away

  1. the application of env patch and
  2. the writing inline code to file and executing there (sinceinline execution lead to parser failures)

was only suitable to execute R codeafter the environment has been installed and was for that reason not used when the renv environment was set up initially.
Hence, the approach I took was to factor out_execute_r() that does 1. and 2. and can be parametrised as far as CLI options passed to R go, so it can be used to create the environment itself (_execute_vanilla_r()) and also later to run R code in it (_execute_r_in_renv(), previously named_execute_vanilla_r_code_as_script()).

@lorenzwalthertlorenzwalthert marked this pull request as ready for reviewJanuary 20, 2025 11:18
otherwise, installing the hooks when RENV_USER env variable is set (e.g. in RStudio with renv project) will result in executing the installation script in the wrong renv
Copy link
Member

@asottileasottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

lorenzwalthert reacted with hooray emoji
@asottileasottile merged commitc3125a4 intopre-commit:mainJan 20, 2025
23 checks passed
@lorenzwalthertlorenzwalthert deleted the dev-always-unset-renv branchJanuary 21, 2025 11:15
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@asottileasottileasottile approved these changes

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

pre-commit does not work when used in a project with R renv

2 participants

@lorenzwalthert@asottile

[8]ページ先頭

©2009-2026 Movatter.jp