Skip to content

Commit 8010378

Browse files
committed
Clarify lintr hook documentation and fix argument names
1 parent 9046c7a commit 8010378

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: precommit
22
Title: Pre-Commit Hooks
3-
Version: 0.4.3.9017
3+
Version: 0.4.3.9018
44
Author: Lorenz Walthert
55
Maintainer: Lorenz Walthert <[email protected]>
66
Description: Useful git hooks for R building on top of the multi-language

vignettes/available-hooks.Rmd

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,21 +366,31 @@ should set this with the field `verbose: true`.
366366

367367
```
368368
id: lintr
369-
args: [--warn-only, --load-package]
369+
args: [--warn_only, --load_package]
370370
verbose: true
371371
```
372372

373-
- `warn-only`: Changes the behavior of the pre-commit to be
373+
- `warn_only`: Changes the behavior of the pre-commit to be
374374
non-blocking. When configured this way, lintr prints lint errors as
375375
they appear.
376376

377-
- `load-package`: When linting a package, {lintr} uses
378-
`pkgload::load_all()` to load the package before running
379-
`lintr::lint()`. Note that you need to list all dependencies of the
380-
package under `additional_dependencies:` for the `lintr:`hook in
381-
your `.pre-commit-config.yaml`. You can generate the code snip o for
382-
c/p with `snippet_generate("additional-deps-lintr")`. This argument
383-
was added in 0.4.3.9005.
377+
- `load_package`: When linting an R package, {lintr} can use
378+
`pkgload::load_all()` to load your package before running `lintr::lint()`.
379+
This allows {lintr} to:
380+
- Recognize internal and exported functions, classes, and methods.
381+
- Read the NAMESPACE to correctly resolve imported functions.
382+
383+
Note that your package's dependencies must be listed in
384+
`additional_dependencies:` in your `.pre-commit-config.yaml` as shown
385+
below. You can generate these for easy c/p with
386+
`snippet_generate("additional-deps-lintr")`. This argument was added in
387+
version 0.4.3.9005.
388+
```
389+
id: lintr
390+
args: [--load_package]
391+
additional_dependencies:
392+
- dplyr
393+
```
384394
385395
The `.lintr` config file as documented in the [`.lintr`
386396
documentation](https://github.com/r-lib/lintr#project-configuration) is

0 commit comments

Comments
 (0)