use_precommit_config {precommit} | R Documentation |
Initiate a pre-commit config file
Description
Initiate a pre-commit config file
Usage
use_precommit_config(
config_source = getOption("precommit.config_source"),
force = FALSE,
open = rstudioapi::isAvailable(),
verbose = FALSE,
root = here::here()
)
Arguments
config_source |
Path or URL to a |
force |
Whether to replace an existing config file. |
open |
Whether or not to open the .pre-commit-config.yaml after
it's been placed in your repo. The default is |
verbose |
Whether or not to communicate what's happening. |
root |
The path to the root directory of your project. |
Value
Character vector of length one with the path to the config file used.
Copying an existing config file
You can use an existing .pre-commit-config.yaml
file when initializing
pre-commit with use_precommit()
using the argument config_source
to
copy an existing config file into your repo. This argument defaults to the R
option precommit.config_source
, so you may want to set this option in
your .Rprofile
for convenience. Note that this is not equivalent to the
--config
option in the CLI command pre-commit install
and similar,
which do not copy a config file into a project root (and allow to put it
under version control), but rather link it in some more or less transparent
way.
Examples
## Not run:
use_precommit_config()
## End(Not run)