Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/hook-dependencies-upate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
"httr" # lintr -> httr -> curl -> libcurl, but seems to give no erorr on
# loading lintr, plus https://github.com/jimhester/lintr/issues/861
)
out <- c(out, "roxygen2", "spelling", "styler", "pkgload", "lintr", "knitr", "git2r", "digest", "desc")
out <- c(out, "roxygen2", "spelling", "styler", "pkgload", "lintr", "knitr", "git2r", "desc")
out <- setdiff(c(unique(c(out, deps[deps$type == "Imports", ]$package))), dont)
out <- names(renv:::renv_package_dependencies(out))
return(out)
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ repos:
- id: roxygenize
additional_dependencies:
- desc@1.3.0
- digest@0.6.27
- docopt@0.7.1
- fs@1.5.0
- git2r@0.28.0
Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ License: GPL-3
URL: https://lorenzwalthert.github.io/precommit/,
https://github.com/lorenzwalthert/precommit
Imports:
R.cache,
cli,
docopt (>= 0.7.1),
fs,
here,
magrittr,
purrr,
R.cache,
rlang,
rprojroot,
rstudioapi,
tibble,
withr,
yaml
Suggests:
desc,
digest,
docopt (>= 0.7.1),
git2r,
glue,
knitr,
Expand All @@ -40,6 +39,7 @@ Suggests:
spelling,
styler,
testthat (>= 2.1.0),
tibble,
usethis (>= 2.0.0)
VignetteBuilder:
knitr
Expand All @@ -49,3 +49,4 @@ Roxygen: list(markdown = TRUE, roclets = c( "rd", "namespace", "collate",
warning("Please install r-lib/pkgapi to make sure the file API is kept
up to date"); NULL} ) )
RoxygenNote: 7.1.2
SystemRequirements: git
6 changes: 6 additions & 0 deletions R/precommit-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ if (getRversion() >= "2.15.1") {
NULL
))
}

if (FALSE) {
# {here} is only used as a dependency for default arguments.
# this is to avoid a false positive CRAN note.
here::here
}
2 changes: 1 addition & 1 deletion R/testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ hook_state_create <- function(tempdir,
files <- fs::path_rel(path_candidate_temp, tempdir)
# https://stat.ethz.ch/pipermail/r-devel/2018-February/075507.html
system2(paste0(Sys.getenv("R_HOME"), "/bin/Rscript"),
args = c(path_executable, cmd_args, files),
args = as.character(c(path_executable, cmd_args, files)),
stderr = path_stderr, stdout = path_stdout, env = env
)
}
Expand Down
4 changes: 4 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ rev_read <- function(path = ".pre-commit-config.yaml", repo = hooks_repo) {
rev_as_pkg_version <- function(rev) {
package_version(gsub("^v", "", rev))
}

has_git <- function() {
nzchar(Sys.which("git"))
}
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ styler
sublicenses
Sublicensing
Sys
SystemRequirements
tcltk
tempfile
testthat
Expand Down
4 changes: 3 additions & 1 deletion inst/hooks/exported/readme-rmd-rendered.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ if (file.exists("README.Rmd") & file.exists("README.md")) {
if (file.info("README.md")$mtime < file.info("README.Rmd")$mtime) {
rlang::abort("README.md is out of date; please re-knit README.Rmd.")
}

if (!nzchar(Sys.which("git"))) {
rlang::abort("git not found on `$PATH`, hook can't be ran.")
}
file_names_staged <- system2(
"git", c("diff --cached --name-only"),
stdout = TRUE
Expand Down
Loading