@@ -71,13 +71,18 @@ for the available settings.
7171## ` style-files `
7272
7373A hook to style files with [ styler] ( https://styler.r-lib.org ) . Only
74- commit code corresponding to the tidyverse style guide. You can pass
75- arguments to
74+ commit code corresponding to the tidyverse style guide.
75+
76+ ** Arguments**
77+
78+ You can pass arguments to
7679[ ` style_file(...) ` ] ( https://styler.r-lib.org/reference/style_file.html )
7780using the ` --key=value ` syntax like this:
7881
79- id: style-files
80- args: [--scope=spaces, --reindention=specify_reindention('#')]
82+ ```
83+ id: style-files
84+ args: [--scope=spaces, --reindention=specify_reindention('#')]
85+ ```
8186
8287In addition, the hook takes the following arguments that are not passed
8388to
8994
9095<!-- -->
9196
92- id: style-files
93- args: [--style_pkg=pkg.with.style.guide, --style_fun=exported.style.function]
97+ ```
98+ id: style-files
99+ args: [--style_pkg=pkg.with.style.guide, --style_fun=exported.style.function]
100+ ```
94101
95102- The argument ` --no-warn-cache ` is deprecated and will be removed in
96103 a future release. Please remove it from your
105112
106113<!-- -->
107114
108- id: style-files
109- args: [--cache-root=styler]
115+ ```
116+ id: style-files
117+ args: [--cache-root=styler]
118+ ```
110119
111120- Argument ` ignore-start ` and ` ignore-stop ` is passed to ` options() `
112121 to set ` styler.ignore_start ` and ` styler.ignore_stop ` respectively.
117126
118127<!-- -->
119128
120- id: style-files
121- args: [--ignore-start="^# styler: on$", --ignore-stop="^# styler: off$"]
129+ ```
130+ id: style-files
131+ args: [--ignore-start="^# styler: on$", --ignore-stop="^# styler: off$"]
132+ ```
122133
123134This hook modifies files unless you specify ` --dry=fail ` (requires
124135` {styler} > 1.3.2 ` ).
@@ -141,31 +152,33 @@ This hook does not modify files.
141152
142153## ` parsable-roxygen `
143154
144- Checks if roxygen comments within your ` .R ` files are "valid" by checking if
145- running ` roxygen2::parse_file() ` on them returns any messages.
155+ Checks if roxygen comments within your ` .R ` files are "valid" by
156+ checking if running ` roxygen2::parse_file() ` on them returns any
157+ messages.
146158
147- This hook does not modify files.
148-
149- ** eval**
150-
151- By default, each file will be parsed, but code will not be evaluated - neither
152- any explicit code in the file, nor any ` @eval ` tags within roxygen comments.
159+ ** Arguments**
153160
154- If your commentary contains ` @eval ` tags which you would prefer to evaluate, you
155- can specify the ` --eval ` flag, which will cause the file's code to be evaluated
156- in an environment created by ` roxygen2::env_file() ` . Note that dependencies of
157- the code to evaluate must be available for pre-commit. You may list these as
158- ` additional_dependencies: ` for the ` parsable-roxygen ` hook in
159- ` .pre-commit-config.yaml ` .
161+ ```
162+ id: parsable-roxygen
163+ args: [--eval]
164+ ```
160165
161- Inline R code within roxygen comments (i.e. within backticks) is ** not**
162- evaluated by this hook, whether or not ` --eval ` is specified. You would need
163- to run the ` roxygenize ` hook for that.
166+ - ` eval ` : By default, each file will be parsed, but code will not be
167+ evaluated - neither any explicit code in the file, nor any ` @eval `
168+ tags within roxygen comments. If your commentary contains ` @eval `
169+ tags which you would prefer to evaluate, you can specify the
170+ ` --eval ` flag, which will cause the file's code to be evaluated in
171+ an environment created by ` roxygen2::env_file() ` . Note that
172+ dependencies of the code to evaluate must be available for
173+ pre-commit. You may list these as ` additional_dependencies: ` for the
174+ ` parsable-roxygen ` hook in ` .pre-commit-config.yaml ` .
164175
165- id: parsable-roxygen
166- args: [--eval]
176+ Inline R code within roxygen comments (i.e. within backticks) is
177+ ** not** evaluated by this hook, whether or not ` --eval ` is
178+ specified. You would need to run the ` roxygenize ` hook for that.
167179
168- This hook was added in version 0.4.3.9000.
180+ This hook does not modify files. This hook was added in version
181+ 0.4.3.9000.
169182
170183## ` no-browser-statement `
171184
@@ -176,8 +189,8 @@ This hook does not modify files.
176189
177190## ` no-print-statement `
178191
179- Guarantees you that you don't accidentally commit code with a
180- ` print() ` statement in it.
192+ Guarantees you that you don't accidentally commit code with a ` print() `
193+ statement in it.
181194
182195This hook does not modify files. This hook was added in version
1831960.3.2.9020.
@@ -217,20 +230,23 @@ readLines(system.file("pre-commit-hooks.yaml", package = "precommit")) %>%
217230 cat(sep = "\n")
218231```
219232
220- ** language**
221-
222- The ` lang ` arg will be passed to ` spelling::spell_check_files() ` .
233+ ** Arguments**
223234
224- id: spell-check
225- args: [--lang=<language>]
235+ ```
236+ id: spell-check
237+ args: [--lang=<language>, --read-only]
238+ ```
226239
227- ** read only**
240+ - ` language ` : The ` lang ` arg will be passed to
241+ ` spelling::spell_check_files() ` .
228242
229- The ` --read-only ` flag will be passed to spell check. This flag makes
230- this hook idempotent.
243+ - ` read-only ` ** : ** The ` --read-only ` flag will be passed to spell
244+ check. This flag makes this hook idempotent.
231245
232- id: spell-check
233- args: [--read-only]
246+ ```
247+ id: spell-check
248+ args: [--read-only]
249+ ```
234250
235251This hook does not modify input files. It will add all words not found
236252in the dictionary to ` inst/WORDLIST ` , assuming they were spelled
@@ -247,9 +263,7 @@ To opt out of updating `inst/WORDLIST` provide the `--read-only` flag.
247263
248264A hook to run ` roxygen2::roxygenize() ` . Makes sure you commit your ` .Rd `
249265changes with the source changes. To take advantage of caching, you don't
250- need to run ` roxygen2::roxygenize() ` manually anymore. The argument
251- ` --no-warn-cache ` is deprecated and will be removed in a future release.
252- Please remove it from your ` .pre-commit-config.yaml ` .
266+ need to run ` roxygen2::roxygenize() ` manually anymore.
253267
254268Because the hook will write the version of {roxygen2} to ` DESCRIPTON ` ,
255269you should either make sure the version you use when you call {roxygen2}
@@ -261,25 +275,32 @@ If you specify additional roclets through the `Roxygen:` field in
261275must specify the dependencies explicitly such that ` renv::install() `
262276understands it, e.g.
263277
264- id: roxygenize
265- additional_dependencies:
266- - r-lib/pkgapi
267-
268- This hook does not modify input files, but writes to ` .Rd ` files in
269- ` man/ ` , ` NAMESPACE ` and potentially others depending on which roxygen
270- roclets you specified in ` DESCRIPTION ` .
278+ ```
279+ id: roxygenize
280+ additional_dependencies:
281+ - r-lib/pkgapi
282+ ```
271283
272284** Arguments**
273285
274286<!-- -->
275287
276- id: roxygenize
277- args: [--root=<R package root>]
288+ ```
289+ id: roxygenize
290+ args: [--root=<R package root>]
291+ ```
278292
279293- Argument ` root ` specifies the directory in the git repo that
280294 contains the R package. Defaults to ` . ` since for most R package git
281295 repos, the git and R package root coincide. Added in version
282296 0.3.3.00000.
297+ - The argument ` --no-warn-cache ` is deprecated and will be removed in
298+ a future release. Please remove it from your
299+ ` .pre-commit-config.yaml ` .
300+
301+ This hook does not modify input files, but writes to ` .Rd ` files in
302+ ` man/ ` , ` NAMESPACE ` and potentially others depending on which roxygen
303+ roclets you specified in ` DESCRIPTION ` .
283304
284305## ` deps-in-desc `
285306
@@ -288,26 +309,23 @@ your DESCRIPTION file. Note that `README.Rmd` is never checked.
288309
289310** Arguments**
290311
312+ ```
313+ id: deps-in-desc
314+ args: [--allow_private_imports, -root=<R package root>]
315+ ```
316+
291317- Flag ` allow_private_imports ` lets the user specify that private
292318 imports into the package namespace are tolerable, e.g.
293319 ` somepkg:::x() ` . Flag not set by default, i.e. the hook will fail if
294320 such a call is found.
295321
296- <!-- -->
297-
298- id: deps-in-desc
299- args: [--allow_private_imports]
322+ <!-- -->
300323
301324- Argument ` root ` specifies the directory in the git repo that
302325 contains the R package. Defaults to ` . ` since for most R package git
303326 repos, the git and R package root coincide. Added in version
304327 0.3.2.9000.
305328
306- <!-- -->
307-
308- id: deps-in-desc
309- args: [--root=<R package root>]
310-
311329This hook does not modify the file ` DESCRIPTION ` because the user should
312330decide for each package if it should go to ` Imports: ` or ` Suggests: ` ,
313331which can be done easily with ` usethis::use_package() ` .
@@ -323,8 +341,10 @@ This hook does modify the file `DESCRIPTION`.
323341
324342<!-- -->
325343
326- id: use-tidy-description
327- args: [--root=<R package root>]
344+ ```
345+ id: use-tidy-description
346+ args: [--root=<R package root>]
347+ ```
328348
329349- Argument ` root ` specifies the directory in the git repo that
330350 contains the R package. Defaults to ` . ` since for most R package git
@@ -333,83 +353,87 @@ This hook does modify the file `DESCRIPTION`.
333353
334354## ` lintr `
335355
336- A hook to run ` lintr::lint() ` to check that R files are lint free.
337- Argument ` warning_only ` changes the behavior of the pre-commit to be
338- non-blocking. You should set this with the field ` verbose: true ` .
356+ A hook to run ` lintr::lint() ` to check that R files are lint free. You
357+ should set this with the field ` verbose: true ` .
339358
340- id: lintr
341- args: [--warn_only]
342- verbose: true
359+ ** Arguments**
343360
344- When configured this way, lintr prints lint errors as they appear. Other
345- arguments are not supported. Instead, ` lintr ` config should be specified
346- in a ` .lintr ` config file in Debian Control Field Format as specified in
347- the [ ` .lintr `
348- documentation] ( https://github.com/r-lib/lintr#project-configuration ) .
361+ ```
362+ id: lintr
363+ args: [--warn-only, --load-package]
364+ verbose: true
365+ ```
366+
367+ - ` warn-only ` : Changes the behavior of the pre-commit to be
368+ non-blocking. When configured this way, lintr prints lint errors as
369+ they appear.
349370
350- When linting a package, ` load_package ` lintr uses ` pkgload::load_all() `
351- to load the package before running ` lintr::lint() ` .
371+ - ` load-package ` : When linting a package, {lintr} uses
372+ ` pkgload::load_all() ` to load the package before running
373+ ` lintr::lint() ` . Note that you need to list all dependencies of the
374+ package under ` additional_dependencies: ` in your
375+ ` .pre-commit-config.yaml ` .
352376
353- id: lintr
354- args: [--load_package]
377+ The ` .lintr ` config file as documented in the [ ` .lintr `
378+ documentation] ( https://github.com/r-lib/lintr#project-configuration ) is
379+ respected.
355380
356381This hook does not modify any file.
357382
358383## ` codemeta-description-updated `
359384
360385Make sure ` DESCRIPTION ` hasn't been edited more recently than
361- ` codemeta.json ` ,
362-
363- i.e. remind you to run ` codemetar::write_codemeta() ` in order to keep
364- ` codemeta.json ` in sync with ` DESCRIPTION ` .
365-
366- This hook does not modify any file.
386+ ` codemeta.json ` , i.e. remind you to run ` codemetar::write_codemeta() ` in
387+ order to keep ` codemeta.json ` in sync with ` DESCRIPTION ` .
367388
368389** Arguments**
369390
370391<!-- -->
371392
372- id: codemeta-description-updated
373- args: [--root=<R package root>]
393+ ```
394+ id: codemeta-description-updated
395+ args: [--root=<R package root>]
396+ ```
374397
375398- Argument ` root ` specifies the directory in the git repo that
376399 contains the R package. Defaults to ` . ` since for most R package git
377- repos, the git and R package root coincide. Added in version
378- 0.3.3.00000.
400+ repos, the git and R package root coincide.
379401
402+ This hook does not modify any file. Added in version 0.3.3.00000.
380403
381404## ` pkgdown `
382405
383- Check if your {pkgdown} config file (e.g. ` _pkgdown.yml ` in your root) has the
384- correct entries for references and articles.
385- This hook skips the time-consuming parts of building the index and reference and
386- only performs the validation. Hence we don't rely on the extensive dependency
387- graph of {pkgdown} being installed, including packages with heavy build-time
388- dependencies and system libraries.
406+ Check if your {pkgdown} config file (e.g. ` _pkgdown.yml ` in your root)
407+ has the correct entries for references and articles. This hook skips the
408+ time-consuming parts of building the index and reference and only
409+ performs the validation. Hence we don't rely on the extensive dependency
410+ graph of {pkgdown} being installed, including packages with heavy
411+ build-time dependencies and system libraries.
389412
390- For this check, we rely on the the global R package library and require all
391- development dependencies of the package you want to run this hook for to be
392- installed, as well as {pkgdown} (without its dependencies).
413+ For this check, we rely on the the global R package library and require
414+ all development dependencies of the package you want to run this hook
415+ for to be installed, as well as {pkgdown} (without its dependencies).
393416
394417This hook does not modify files. Added in version 0.3.2.9003.
395418
396-
397419## ` renv-lockfile-validate `
398420
399- Guarantees that you don't accidentally commit an invalid ` renv.lock ` file.
400- See [ ` renv::lockfile_validate() ` documentation] ( https://rstudio.github.io/renv/reference/lockfile_validate.html )
401- for details.
421+ Guarantees that you don't accidentally commit an invalid ` renv.lock `
422+ file. See [ ` renv::lockfile_validate() `
423+ documentation] ( https://rstudio.github.io/renv/reference/lockfile_validate.html )
424+ for details. The below config that uses only ` --error ` should suffice
425+ for most users.
402426
403- The below config that uses only ` --error ` should suffice for most users.
404-
405- id: renv-lockfile-validate
406- args: [--error]
407-
408- This hook does not modify files. Added in version 0.4.3.9005.
427+ ```
428+ id: renv-lockfile-validate
429+ args: [--error]
430+ ```
409431
410432** Arguments**
411433
412- <!-- -->
434+ ```
435+ id: renv-lockfile-validate
436+ args: [--schema=<schema>] [--greedy --error --verbose --strict]
437+ ```
413438
414- id: renv-lockfile-validate
415- args: [--schema=<schema>] [--greedy --error --verbose --strict]
439+ This hook does not modify files. Added in version 0.4.3.9005.
0 commit comments