Thanks to all who contributed to this release: @boxydog, @hadley, @IndrajeetPatil, @jcken95, @jeancochrane, @jrdnbradford, @lorenzwalthert, @owenjonesuob, and @TymekDev.
Release relax the dependency on third-party error messages in our unit tests (#555).
This release ensures unit tests can handle the error messages from {styler} correctly that were modified slightly. Apart from hook dependency updates, this release adds no user-facing changes.
Thanks @joshpersi for contributing to this release.
Apart from two new hooks, many bug fixes and a few minor features, this release focused on improving the user experience when installing the hooks, which caused users the most troubles. We enabled fast hook installation without the need for build time or system dependencies on all platforms thanks to the Posit Package Manager and removal of dependencies {git2r} and {digest}.
Features
no-print-statement discovers and check for
rogue print statements (#505).pkgdown runs
pkgdown::check_pkgdown() to ensure the {pkgdown} config is
valid (#393).codemeta-description-updated, roxygenize,
and use-tidy-description now all support a
root argument that specifies the directory in the git repo
that contains the R package. Defaults to . since for most R
package git repos, the git and R package root coincide (#432,
#438).style-files now supports styling of R code in Quarto
docs (#449).style-files now supports file names with spaces
(#516).Bug Fixes
spelling::update_wordlist
(#514).Documentation
use_ci() is now documented to take NA, not
NULL for argument ci (#431).Dependencies
Infrastructure
ubuntu-latest instead of pinned version for tests
(#481).read-only flag for testing (#529).Other
Changelog from dev releases is collapsed into this patch release at
the time this release is created. If you need releases by dev release,
i.e. 0.3.2.x, checkout this file at git tag
v0.3.2.9020.
A big thanks goes to all people who made this release reality:
@AliSajid, @averissimo, @clarkliming, @danielinteractive, @denn173, @dependabot[bot], @EzicJ, @fabianegli, @hadley, @IndrajeetPatil, @jashapiro, @joelnitta, @jonathanckt, @jsnel, @kcphila, @KoderKow, @KyleDCox, @lorenzwalthert, @m-muecke, @mythichamster, @ns-rse, @pre-commit-ci[bot], @russHyde, @sempwn, @stefanoborini, @thefabnab, @TNonet, @TymekDev, and @yogat3ch.
parsable-R hook now gives more context on where and how
parsing fails (#423).Thanks to @danielinteractive, @jonocarroll for their contributions.
User visible changes
.pre-commit-config.yaml templates now contain hook to
validate the pre-commit.ci
configuration (#407).Bug fixes
spell-check hook is case-insensitive
on all operating systems. This may re-order your whole
inst/WORDLIST (#405).forbid-to-commit in template
.pre-commit-config.yaml has now the correct
exclude-files regular expression to ignore
.csv, .RData, .Rds,
.rds and .Rhistory (#410).Internals
options(install.packages.compile.from.source = "never")
is used in the CI to avoid failing builds due to missing build-time deps
(#412).Thanks to @danielinteractive and @mpadge for their contributions.
API changes
style-files hook now takes
ignore-start and ignore-stop arguments, passed
to options("styler.ignore_start") and
options("styler.ignore_stop"). By default, {styler}
defaults are used.use_precommit() now exposes the argument
autoupdate, defaulting to TRUE (which was the
previous behavior). This tells {precommit} whether or not to run
autoupdate() as part of the former function invocation
(#386).New features
no-debug-statement checks for leftover
debug() and debugonce() statements in the
committed code (#385, @lukasfeick-sw)..pre-commit-config.yaml does now include
the hook file-contents-sorter to sort
.Rbuildignore (#366)..pre-commit-config.yaml default to monthly
hook updates (instead of weekly) to avoid notification triggers and git
version convolution (#370).language: r
(#350).Documentation
Bug fixes
R as a dependency with
snippet_generate("additional-deps-roxygenize") (#358).roxygenize hook now fails if it generates an
.Rd file that is not tracked with version control
(#363).deps-in-desc and parsable-R can now handle
code chunk headers with where purl or eval are
not literals like TRUE, but variables defined elsewhere in
code (#361, #382).deps-in-desc now prints the original file (not a
tempfile) also for .Rmd and .Rnw files.Thanks to all people who contributed to this release: @assignUser, @danhalligan, @gravesti, @hadley, @KyleDCox, @lorenzwalthert, @lukasfeick-sw, @MarkMc1089, @pat-s, @RoyalTS, and @smingerson.
This is a maintenance release on the request of CRAN (#337) and to
improve experience with the language: r switch conducted in
v0.2.0. In particular, note that projects using {renv} and
RStudio are not very compatible with hook versions > 0.1.3.9014 and
autoupdate() results in downgrading the hook versions
(#346).
API Changes
--no-warn-cache in the
style-files and the roxygenize hook is
deprecated and will be removed in a future release. Please remove it
from your .pre-commit-config.yaml (#340. #341).Other changes
style-files hook fails more informatively if required
package is not listed in additional_dependencies:
(#333).deps-in-desc always excludes README.md
(#336).roxygenize problem handling (#338).snippet_generate("additional-deps-roxygenize") (#344)Thanks to all people who contributed to this release:
@lorenzwalthert, @pat-s, and @smingerson.
This version marks the switch to language: r of all
existing hooks. This means two things:
pre-commit >= 2.11.1 (ideally even
>= 2.13.0). See *Installation/Update** below (#233,
#250, #260, #264, #273, #315, #313, #308, #301, #300, #295, #285,
#328).style-files). See
vignette("ci") for a comparison of the two services
(#318).API changes
use_precommit() gains a new argument ci
defaulting to "native" (for pre-commit) to set up continuous
integration. Other allowed values are "gha" (forNULL (for no CI).use_ci(ci = "native") can be
used to set up continuous integration for existing repos. The default
behavior for ci for both functions is governed by the R
option precommit.ci.version_precommit() and update_precommit()
are new functions to check the version of the installed pre-commit
executable and to update it (#197).style-files hook gains an argument
--cache-root that is passed to
options(styler.cache_root = ...) (#305).style-files hook now supports the full style_file()
API, e.g. you can supply --scope=spaces and similar via
args: in your .pre-commit-config.yaml. See the
docs
for details.style-files and roxygenize hooks now warn
if there is no permanent {R.cache} cache set up. You can
silence the warning with the hook argument --no-warn-cache
(#225).Installation/Update
Please follow the update instructions or installation instructions depending on whether or not you previously used pre-commit.
Major changes
roxygenize hook runs pkgload::load_all(), you
need to list all dependencies of your package in
additional_dependencies field in
.pre-commit-config.yaml. You will be prompted to add them
if they are missing,
precommit::snippet_generate("additional-deps-roxygenize")
generates the code you can copy/paste (#247, #248, #249).parsable-R hook can now also parse
.Rmd files (#325).use_precommit(..., install_hooks = TRUE) is no longer
blocking by default. New option
precommit.block_install_hooks (defaults to
FALSE) governs the behavior (#312).inst/WORDLIST (#303)..lintr and .gitlab-ci.yml are not ignored
in the spell check hook (#317).Unknown or uninitialised column: text (#268).deps-in-desc now checks .Rprofile,
.Rmd and .Rnw files in addition to
.R files (#216)..Rmd,
.Rnw and .Rprofile files (#287).{renv} infra files are not checked anymore by default
in the template config files (#237)..png, .jpeg, .pdf and files
in .github/workflows are no longer spell-checked in the
template config file (#276).Minor changes
fs >= 1.5.1
(#330).exclude: pattern of the spell
check hook are now ordered alphabetically (#276).deps-in-desc hook now points to the hook argument
--allow_private_imports when the hook fails due to private
imports (#254).lorenzwalthert/precommit. This does not affect
users directly (#430).A big hand to all the contributors of this release:
@adamblake, @arbues6, @b4D8, @bart1, @dhersz, @joelnitta, @jucor, @lorenzwalthert, @lukasfeick-sw, @MarkMc1089, @njtierney, @pat-s, @pwildenhain, and @rossdrucker
For previous versions of NEWS.md with news bullet per
patch release, see the latest
NEWS.md before gathering.
This is mainly a CRAN maintenance release because of #201 and includes some bug fixes and no API changes.
A big hand to all the contributors of this release: @fschoner, @krzyslom, @lorenzwalthert, @maurolepore, @pat-s, and @zkamvar.
Minor Changes
use_precommit() should now work as
expected (#185).use_precommit() now writes to the right
.Rbuildignore when root is not the current
working directory (#188, @krzyslom).precommit::uninstall_precommit() now correctly removes
^\\.pre-commit-config.yaml$from .Rbuildignore
and does not show a prompt (#199).Initial CRAN release. See https://lorenzwalthert.github.io/precommit/.
Major Changes
use_precommit() gains new
install_hooks = TRUE parameter. Now all hook environments
defined in yaml config are by default installed in advance. (#163)Breaking Changes
uninstall_precommit()’s scope argument
value "global" was renamed to "user".Major Changes
.pre-commit-config-config.yaml for the spell check
hook for easy manipulation. Also, additional patterns were excluded such
as .sh (#157).Minor Changes
DESCRIPTION now links the pkgdown website in addition
to the GitHub repo (#155)..Renviron, .Rrofile, .RData,
.feather and .Rds is now also excluded from
the spell checking hook.Breaking Changes
A major API review was conducted to make the package ready for a CRAN submission in #152:
path_root renamed to
root.root now always defaults to
here::here() for consistency.config_source was renamed to
config_source in use_precommit_config() and
use_precommit().use_precommit_config’s argument force
gains a default value for consistency with
use_config().use_precommit_config’s argument verbose
now is in the same position as in use_config().Additional breaking changes are:
r-precommit instead of
r-reticulate to avoid conflicts with other packages
commonly installed in r-reticulate (#147).spell-check does no longer take the hook
argument ignore-files since this was inconsistent with the
pre-commit framework. To exclude additional files, specify the
exclude: key in your .pre-commit-config.yaml
file. If you like to keep excluding the default files, make sure you
include the default
regex (#153).git diff --cached
contains roxygen comments (#151).Test release process.
use_precommit() gains new argument
config_source to copy an existing config file into the repo
at initialization. The argument defaults to
options('precommit.config_source') to make it easy for
users to use their preferred hooks in every repo they initialize
(#111).r-precommit env if not existent before
installing into it (#114)..pre-commit-config.yaml includes hook to check
files have a EOF blank line (#126).path_pre_commit_exec() in favor of
path_precommit_exec() and adapt internals to replace
pre_commit with precommit (#130).BREAKING: If you used precommit < 0.0.0.9017
(and if you choose a different installation strategy than
precommit::install_precommit()), you can link your existing executable by setting the R optionprecommit.executable`
to the path where you stored the pre-commit executable.
Adding tools to work with hooks:
install_precommit(), use_precommit(),
uninstall_precommit(), open_config() and
open_wordlist() using conda environments on all
platforms.
Make repo a fully R CMD CHECK compliant R package (includes
moving hooks to inst/bin from bin.)
renamed repo from pre-commit-hooks to precommit.
added pkgdown website, restructured README.