You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/FAQ.Rmd
+56-45Lines changed: 56 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,11 @@ title: "FAQ"
3
3
output: rmarkdown::html_vignette
4
4
vignette: >
5
5
%\VignetteIndexEntry{FAQ}
6
-
%\VignetteEngine{knitr::rmarkdown}
7
6
%\VignetteEncoding{UTF-8}
7
+
%\VignetteEngine{knitr::rmarkdown}
8
+
editor_options:
9
+
markdown:
10
+
wrap: 72
8
11
---
9
12
10
13
```{r, include = FALSE}
@@ -18,81 +21,89 @@ knitr::opts_chunk$set(
18
21
## How does it work? What's the magic?
19
22
20
23
No magic. Git [provides a mechanism for pre-commit
21
-
hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). Since it's
22
-
cumbersome to copy bash scripts and keep them updated in some hidden `.git/`
23
-
directory, people wrote frameworks to basically maintain these files. One of
24
-
them is [pre-commit.com](https://pre-commit.com). So you call git to commit, git calls
25
-
its internal hooks, these hooks (bash scripts in the simplest case) are provided
26
-
by the pre-commit framework. And where does pre-commit get all it's nice hooks
27
-
from? From us.
24
+
hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). Since
25
+
it's cumbersome to copy bash scripts and keep them updated in some
26
+
hidden `.git/`directory, people wrote frameworks to basically maintain
27
+
these files. One of them is [pre-commit.com](https://pre-commit.com). So
28
+
you call git to commit, git calls its internal hooks, these hooks (bash
29
+
scripts in the simplest case) are provided by the pre-commit framework.
30
+
And where does pre-commit get all it's nice hooks from? From us.
28
31
29
32
## How are hooks accessed? What happens if there's no internet connection?
30
33
31
-
Internet connection is required during installation
32
-
(`precommit::install_precommit()`) and project initialization
33
-
(`precommit::use_precommit()`) as well as when hooks are updated
34
-
(`precommit::autoupdate()`). Otherwise, no internet connection is required.
35
-
During initialization, hooks from this repo will be placed in a virtual
36
-
environment within the user cache and upon committing, they are called from a
37
-
generic hook helper in `.git/hooks/`.
34
+
Internet connection is required during installation
35
+
(`precommit::install_precommit()`) and project initialization
36
+
(`precommit::use_precommit()`) as well as when hooks are updated
37
+
(`precommit::autoupdate()`). Otherwise, no internet connection is
38
+
required. During initialization, hooks from this repo will be placed in
39
+
a virtual environment within the user cache and upon committing, they
40
+
are called from a generic hook helper in `.git/hooks/`.
38
41
39
42
## Why do some hooks not give me the same results as running the command interactively?
40
43
41
-
Note that starting with `precommit > 0.1.3`, hooks run in an isolated
42
-
[`{renv}`](https://rstudio.github.io/renv/), leveraging [R as a supported language](https://pre-commit.com/#r) in the pre-commit framework. The version of a package you use interactively
43
-
(e.g. `{roxygen2}` to document) might for that reason be different from the one
44
-
pre-commit uses. The point of using pre-commit is to take mental burden off your
45
-
shoulders (and sometimes even caches results for speed), so there is no need to
46
-
run functionality covered by the hooks manually anyways. If you need to know
47
-
which package versions are used, look for the `renv.lock` file in
48
-
https://github.com/lorenzwalthert/precommit at the git tag specified under
49
-
`rev:` in your `.pre-commit-config.yaml`.
44
+
Note that starting with `precommit > 0.1.3`, hooks run in an isolated
45
+
[`{renv}`](https://rstudio.github.io/renv/), leveraging [R as a
46
+
supported language](https://pre-commit.com/#r) in the pre-commit
47
+
framework. The version of a package you use interactively (e.g.
48
+
`{roxygen2}` to document) might for that reason be different from the
49
+
one pre-commit uses. The point of using pre-commit is to take mental
50
+
burden off your shoulders (and sometimes even caches results for speed),
51
+
so there is no need to run functionality covered by the hooks manually
52
+
anyways. If you need to know which package versions are used, look for
53
+
the `renv.lock` file in <https://github.com/lorenzwalthert/precommit> at
54
+
the git tag specified under `rev:` in your `.pre-commit-config.yaml`.
50
55
51
56
## Can you use it outside RStudio?
52
57
53
-
Yes, all but the `open_config()` and `open_wordlist()` to open files in RStudio.
58
+
Yes, all but the `open_config()` and `open_wordlist()` to open files in
59
+
RStudio.
54
60
55
61
## Can I use the hooks provided in this package without installing the R package?
56
62
57
-
Yes, you don't need to manually install this package. Although technically
58
-
speaking, this package will get installed into a virtual environment isolated
59
-
from your global and project library.
63
+
Yes, you don't need to manually install this package. Although
64
+
technically speaking, this package will get installed into a virtual
65
+
environment isolated from your global and project library.
60
66
61
67
## How can I make sure that my contributors are using the hooks?
62
68
63
-
They must follow the installation instructions in the README, i.e. run
69
+
They must follow the installation instructions in the README, i.e. run
To enforce all hooks pass, you can follow the [advice on how to use pre-commit in a CI/CD setup](https://pre-commit.com/#usage-in-continuous-integration).
81
+
To enforce all hooks pass, you can follow the [advice on how to use
0 commit comments