Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: precommit
Title: Pre-Commit Hooks
Version: 0.4.3.9017
Version: 0.4.3.9018
Author: Lorenz Walthert
Maintainer: Lorenz Walthert <[email protected]>
Description: Useful git hooks for R building on top of the multi-language
Expand Down
28 changes: 19 additions & 9 deletions vignettes/available-hooks.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -366,21 +366,31 @@ should set this with the field `verbose: true`.

```
id: lintr
args: [--warn-only, --load-package]
args: [--warn_only, --load_package]
verbose: true
```

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

- `load-package`: When linting a package, {lintr} uses
`pkgload::load_all()` to load the package before running
`lintr::lint()`. Note that you need to list all dependencies of the
package under `additional_dependencies:` for the `lintr:`hook in
your `.pre-commit-config.yaml`. You can generate the code snip o for
c/p with `snippet_generate("additional-deps-lintr")`. This argument
was added in 0.4.3.9005.
- `load_package`: When linting an R package, {lintr} can use
`pkgload::load_all()` to load your package before running `lintr::lint()`.
This allows {lintr} to:
- Recognize internal and exported functions, classes, and methods.
- Read the NAMESPACE to correctly resolve imported functions.

Note that your package's dependencies must be listed in
`additional_dependencies:` in your `.pre-commit-config.yaml` as shown
below. You can generate these for easy c/p with
`snippet_generate("additional-deps-lintr")`. This argument was added in
version 0.4.3.9005.
```
id: lintr
args: [--load_package]
additional_dependencies:
- dplyr
```

The `.lintr` config file as documented in the [`.lintr`
documentation](https://github.com/r-lib/lintr#project-configuration) is
Expand Down