Skip to content

Commit f3e7253

Browse files
fix urls and make visual mode compatible
1 parent 82a061c commit f3e7253

File tree

7 files changed

+500
-439
lines changed

7 files changed

+500
-439
lines changed

vignettes/FAQ.Rmd

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ title: "FAQ"
33
output: rmarkdown::html_vignette
44
vignette: >
55
%\VignetteIndexEntry{FAQ}
6-
%\VignetteEngine{knitr::rmarkdown}
76
%\VignetteEncoding{UTF-8}
7+
%\VignetteEngine{knitr::rmarkdown}
8+
editor_options:
9+
markdown:
10+
wrap: 72
811
---
912

1013
```{r, include = FALSE}
@@ -18,81 +21,89 @@ knitr::opts_chunk$set(
1821
## How does it work? What's the magic?
1922

2023
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.
2831

2932
## How are hooks accessed? What happens if there's no internet connection?
3033

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/`.
3841

3942
## Why do some hooks not give me the same results as running the command interactively?
4043

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`.
5055

5156
## Can you use it outside RStudio?
5257

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

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

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

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

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
70+
6471
```{r}
6572
remotes::install_github("lorenzwalthert/precommit")
6673
precommit::install_precommit()
6774
precommit::use_precommit()
6875
```
6976

70-
The last call can be omitted by users who have [automatically enabled
71-
pre-commit hooks](https://pre-commit.com/#automatically-enabling-pre-commit-on-repositories).
77+
The last call can be omitted by users who have [automatically enabled
78+
pre-commit
79+
hooks](https://pre-commit.com/#automatically-enabling-pre-commit-on-repositories).
7280

73-
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
82+
pre-commit in a CI/CD
83+
setup](https://pre-commit.com/#usage-in-continuous-integration).
7484

7585
## Should I list `{precommit}` as a dependency of my package in DESCRIPTION?
7686

77-
No, precommit is a dev dependency like `{devtools}`, so it should not be listed
78-
in `DESCRIPTION`.
79-
87+
No, precommit is a dev dependency like `{devtools}`, so it should not be
88+
listed in `DESCRIPTION`.
8089

8190
## What if not all people who are committing to this repo want to use the hooks?
8291

8392
This is not a problem, git will only run the hooks in a local repo after
84-
`precommit::use_precommit()` has been run successfully from within this local repo on your machine.
85-
You can also uninstall anytime with `precommit::uninstall_precommit()`. Anyone
86-
who does not want to use the hooks simply should not run
87-
`precommit::use_precommit()`. You can also temporarily disable hooks using the
88-
environment variable `SKIP` or the argument `--no-verify`, as
89-
described [here](https://pre-commit.com/#temporarily-disabling-hooks).
90-
93+
`precommit::use_precommit()` has been run successfully from within this
94+
local repo on your machine. You can also uninstall anytime with
95+
`precommit::uninstall_precommit()`. Anyone who does not want to use the
96+
hooks simply should not run `precommit::use_precommit()`. You can also
97+
temporarily disable hooks using the environment variable `SKIP` or the
98+
argument `--no-verify`, as described
99+
[here](https://pre-commit.com/#temporarily-disabling-hooks).
91100

92101
## How does one create a new pre-commit hook?
93102

94-
How to contribute new hooks is explained in [`CONTRIBUTING.md`](https://github.com/lorenzwalthert/precommit/blob/main/CONTRIBUTING.md).
103+
How to contribute new hooks is explained in
104+
[`CONTRIBUTING.md`](https://github.com/lorenzwalthert/precommit/blob/main/CONTRIBUTING.md).
95105

96-
***
106+
------------------------------------------------------------------------
97107

98-
There is more. Check out the documentation of the [pre-commit](https://pre-commit.com) framework.
108+
There is more. Check out the documentation of the
109+
[pre-commit](https://pre-commit.com) framework.

0 commit comments

Comments
 (0)