When initializing pre-commit in your repo with
precommit::use_precommit(), you can specify the Continuous
integration provider with ci = "native" if you want to use
pre-commit.ci or
ci = "gha" if you want to use GitHub Actions. For existing
repos, use precommit::use_ci().
Pre-commit will run the hooks on all files, so instead of pushing, waiting and fixing issues locally, we recommend that you fix all problems before pushing by invoking pre-commit (roughly) the same way as it happens in the CI, which is described in the next section.
In the CI run, a command roughly equivalent to the following will be ran from the command line:
If you get an error and pre-commit is not on your
$PATH (e.g. because you installed with
precommit::install_precommit()), you can locate the
executable from R with
And run the command in your bash terminal like this:
Then fix the problems, stage the files and re-try until the command succeeds without more errors.
Next, we quickly introduce the two options. We recommend pre-commit.ci, but you might have to skip the roxygenize hook in the ci run under certain circumstances as explained below.
Pros:
.pre-commit-config.yaml are
supported.Cons:
You need to authenticate the pre-commit.ci App in GitHub.
Limitations for the roxygenize hook:
.pre-commit-config.yaml under id: roxygenize.
You can generate the required code with
precommit::snippet_generate('additional-deps-roxygenize').
This is also required to run the hook locally.To overcome the above limitations, you can:
.pre-commit-config.yaml).precommit::use_ci("gha").Customization:
Please see the documentation of pre-commit.ci on whether or not to auto-fix problems as well as other configuration options.
Pros:
Cons:
Need a high-speed mirror for your open-source project?
Contact our mirror admin team at info@clientvps.com.
This archive is provided as a free public service to the community.
Proudly supported by infrastructure from VPSPulse , RxServers , BuyNumber , UnitVPS , OffshoreName and secure payment technology by ArionPay.