Skip to content

Commit

Permalink
add note related to PRE_COMMIT env variable, compare (#165).
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert committed Sep 24, 2020
1 parent d2252f0 commit 94ace07
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vignettes/FAQ.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ How to contribute new hooks is explained in [`CONTRIBUTING.md`](https://github.c
Some of the hooks depend on R functions that run slowly, e.g. the `style-files`
hook depends on `styler`, which is not very fast. Also, note that for each hook,
R is started. Make sure your startup process is quick for non-interactive use,
e.g. your `.Rprofile` and related files do not have a long execution time. E.g.
wrap code in `if (interactive()) ` if possible, so it won't run when pre-commit
hooks are ran. Find out more about the startup process with `?startup`. We'd
like to support the `--vanilla` option but it's
[not easily possible we believe](https://github.com/lorenzwalthert/precommit/issues/165).
e.g. your `.Rprofile` and related files do not have a long execution time when
pre-commit calls them. You can wrap code in `if (interactive()) ` to only
execute it in an interactive session or wrap it in
`if (Sys.getenv("PRE_COMMIT") != "1")` (if you have `pre-commit >= 2.5.0`), so
it won't run when pre-commit hooks are ran. Find out more about the startup
process with `?startup`.

***

Expand Down

0 comments on commit 94ace07

Please sign in to comment.