Skip to content
Closed
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
5 changes: 4 additions & 1 deletion inst/hooks/exported/lintr.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@

"Run lintr on R files during a precommit.
Usage:
lintr [--warn_only] <files>...
lintr [--warn_only] [--root=<root_>] <files>...
Options:
--warn_only Print lint warnings instead of blocking the commit. Should be
used with `verbose: True` in `.pre-commit-config.yaml`.
Otherwise, lints will never be shown to the user.
--root=<root_> Path relative to the git root that contains the R package root [default: .].
" -> doc

arguments <- precommit::precommit_docopt(doc)
arguments$files <- normalizePath(arguments$files) # because working directory changes to root
setwd(normalizePath(arguments$root))

lintr_staged <- grepl(
"modified:.*\\.lintr", system2("git", "status", stdout = TRUE)
Expand Down
Loading