Skip to content

Commit

Permalink
note on slow hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert committed May 2, 2020
1 parent 0a5cc63 commit 4bcad27
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion vignettes/FAQ.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ Yes, all but the `open_config()` and `open_wordlist()` to open files in RStudio.

## Can I use the hooks provided in this package without installing the R package?

Yes. The hooks work even if you don't have the R package installed
Yes, apart from the `roxygenize` hook (which uses an exported function from
{precommit}). The hooks work even if you don't have the R package installed
because all you need to have for the hooks to work is the pre-commit executable.
It will `git clone` the hooks from this repo into `.git/hooks` or similar. All
exported functions of this package are just for the users convenience.


## How can I make sure that my contributors are using the hooks?

They must follow the installation instructions in the README, i.e. run
Expand Down Expand Up @@ -75,6 +77,16 @@ described [here](https://pre-commit.com/#temporarily-disabling-hooks).

How to contribute new hooks is explained in [`CONTRIBUTING.md`](https://github.com/lorenzwalthert/precommit/blob/master/CONTRIBUTING.md).

## Why are my hooks running slowly?

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).

***

Expand Down

0 comments on commit 4bcad27

Please sign in to comment.