# All available hooks: https://pre-commit.com/hooks.html
# R specific hooks: https://github.com/lorenzwalthert/precommit
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.3
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
- id: roxygenize
# roxygen requires loading pkg -> add dependencies from DESCRIPTION
additional_dependencies:
- Rcpp
- readr
- Rfast
- stats
- stringi
# codemeta must be above use-tidy-description when both are used
# - id: codemeta-description-updated
- id: use-tidy-description
- id: spell-check
exclude: >
(?x)^(
.*\.[rR]|
.*\.feather|
.*\.jpeg|
.*\.pdf|
.*\.png|
.*\.py|
.*\.RData|
.*\.rds|
.*\.Rds|
.*\.Rproj|
.*\.sh|
(.*/|)\.gitignore|
(.*/|)\.gitlab-ci\.yml|
(.*/|)\.lintr|
(.*/|)\.pre-commit-.*|
(.*/|)\.Rbuildignore|
(.*/|)\.Renviron|
(.*/|)\.Rprofile|
(.*/|)\.travis\.yml|
(.*/|)appveyor\.yml|
(.*/|)NAMESPACE|
(.*/|)renv/settings\.dcf|
(.*/|)renv\.lock|
(.*/|)WORDLIST|
\.github/workflows/.*|
data/.*|
)$
- id: lintr
- id: readme-rmd-rendered
- id: parsable-R
- id: no-browser-statement
- id: no-print-statement
- id: no-debug-statement
- id: deps-in-desc
- id: pkgdown
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
args: ['--maxkb=200']
- id: file-contents-sorter
files: '^\.Rbuildignore$'
- id: end-of-file-fixer
exclude: '\.Rd'
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
# Only required when https://pre-commit.ci is used for config validation
- id: check-pre-commit-ci-config
- repo: local
hooks:
- id: forbid-to-commit
name: Don't commit common R artifacts
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
language: fail
files: '\.(Rhistory|RData|Rds|rds)$'
# `exclude: <regex>` to allow committing specific files
ci:
autoupdate_schedule: monthly
skip: [pkgdown]
$ git commit -m "Testing roxygenize hook"
[INFO] Installing environment for https://github.com/lorenzwalthert/precommit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Library/Frameworks/R.framework/Resources/bin/Rscript', '--no-save', '--no-restore', '--no-site-file', '--no-environ', '/var/folders/zk/8t6nr57d6_l_s0hvcc7j2xxw0000gr/T/tmpjbd15eep/script.R', 'Rcpp', 'readr', 'Rfast', 'stats', 'stringi')
return code: 1
stdout:
- The project is out-of-sync -- use `renv::status()` for details.
- The project is out-of-sync -- use `renv::status()` for details.
# Downloading packages -------------------------------------------------------
- Downloading readr from RSPM ... OK [file is up to date]
- Downloading clipr from RSPM ... OK [file is up to date]
- Downloading hms from RSPM ... OK [file is up to date]
- Downloading pkgconfig from RSPM ... OK [file is up to date]
- Downloading tibble from RSPM ... OK [file is up to date]
- Downloading fansi from RSPM ... OK [file is up to date]
- Downloading pillar from RSPM ... OK [file is up to date]
- Downloading utf8 from RSPM ... OK [file is up to date]
- Downloading vroom from RSPM ... OK [file is up to date]
- Downloading bit64 from RSPM ... OK [file is up to date]
- Downloading bit from RSPM ... OK [file is up to date]
- Downloading tidyselect from RSPM ... OK [file is up to date]
- Downloading tzdb from RSPM ... OK [file is up to date]
- Downloading progress from RSPM ... OK [file is up to date]
- Downloading prettyunits from RSPM ... OK [file is up to date]
Traceback (most recent calls last):
15: renv::install(commandArgs(trailingOnly = TRUE))
14: retrieve(packages)
13: handler(package, renv_retrieve_impl(package))
12: renv_retrieve_impl(package)
11: withCallingHandlers(renv_available_packages_latest(package),
error = function(err) stopf("package '%s' is not available",
package))
10: renv_available_packages_latest(package)
9: map(errors$data(), warning)
8: lapply(x, f, ...)
7: FUN(X[[i]], ...)
6: withRestarts({
.Internal(.signalCondition(cond, message, call))
.Internal(.dfltWarn(message, call))
}, muffleWarning = function() NULL)
5: withOneRestart(expr, restarts[[1L]])
4: doWithOneRestart(return(expr), restart)
3: <condition-handler>(...)
2: stopf("package '%s' is not available", package)
1: stop(sprintf(fmt, ...), call. = call.)
stderr:
Error: package 'Rfast' is not available
Execution halted
Check the log at /Users/pschloss/.cache/pre-commit/pre-commit.log
Before filing a bug
remotes::install_github('lorenzwalthert/precommit')precommit::autoupdate())Describe the bug
I'm trying to use the roxygenize hook with my package and went through the setup to copy and paste the package dependencies into the yaml. It complains that it cannot install {Rfast}, which I have installed on my computer for the package so I wouldn't think it should be a problem. There's also a lot of stuff popping up about
rvest::setup()- I'm not using {rvest} with this package.My
.pre-commit-config.ymlfile is:To Reproduce
Expected behavior
I would expect it to flag an Rd file for being out of step with the roxygen comments in one of my code files.
Additional context
packageVersion('renv')