Skip to content

Commit ed2de3f

Browse files
Merge pull request #348 from lorenzwalthert/fix-rmd-check
- Fix rmd check
2 parents 00612d6 + 559e4e4 commit ed2de3f

File tree

10 files changed

+150
-156
lines changed

10 files changed

+150
-156
lines changed

.github/workflows/hook-dependencies-upate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
"httr" # lintr -> httr -> curl -> libcurl, but seems to give no erorr on
5454
# loading lintr, plus https://github.com/jimhester/lintr/issues/861
5555
)
56-
out <- c(out, "roxygen2", "spelling", "styler", "pkgload", "lintr", "knitr", "git2r", "digest", "desc")
56+
out <- c(out, "roxygen2", "spelling", "styler", "pkgload", "lintr", "knitr", "git2r", "desc")
5757
out <- setdiff(c(unique(c(out, deps[deps$type == "Imports", ]$package))), dont)
5858
out <- names(renv:::renv_package_dependencies(out))
5959
return(out)

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ repos:
1717
- id: roxygenize
1818
additional_dependencies:
1919
20-
2120
2221
2322

DESCRIPTION

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,21 @@ License: GPL-3
1212
URL: https://lorenzwalthert.github.io/precommit/,
1313
https://github.com/lorenzwalthert/precommit
1414
Imports:
15-
R.cache,
1615
cli,
17-
docopt (>= 0.7.1),
1816
fs,
1917
here,
2018
magrittr,
2119
purrr,
20+
R.cache,
2221
rlang,
2322
rprojroot,
2423
rstudioapi,
25-
tibble,
2624
withr,
2725
yaml
2826
Suggests:
2927
desc,
3028
digest,
29+
docopt (>= 0.7.1),
3130
git2r,
3231
glue,
3332
knitr,
@@ -40,6 +39,7 @@ Suggests:
4039
spelling,
4140
styler,
4241
testthat (>= 2.1.0),
42+
tibble,
4343
usethis (>= 2.0.0)
4444
VignetteBuilder:
4545
knitr
@@ -49,3 +49,4 @@ Roxygen: list(markdown = TRUE, roclets = c( "rd", "namespace", "collate",
4949
warning("Please install r-lib/pkgapi to make sure the file API is kept
5050
up to date"); NULL} ) )
5151
RoxygenNote: 7.1.2
52+
SystemRequirements: git

R/precommit-package.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ if (getRversion() >= "2.15.1") {
2121
NULL
2222
))
2323
}
24+
25+
if (FALSE) {
26+
# {here} is only used as a dependency for default arguments.
27+
# this is to avoid a false positive CRAN note.
28+
here::here
29+
}

R/testing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ hook_state_create <- function(tempdir,
141141
files <- fs::path_rel(path_candidate_temp, tempdir)
142142
# https://stat.ethz.ch/pipermail/r-devel/2018-February/075507.html
143143
system2(paste0(Sys.getenv("R_HOME"), "/bin/Rscript"),
144-
args = c(path_executable, cmd_args, files),
144+
args = as.character(c(path_executable, cmd_args, files)),
145145
stderr = path_stderr, stdout = path_stdout, env = env
146146
)
147147
}

R/utils.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,7 @@ rev_read <- function(path = ".pre-commit-config.yaml", repo = hooks_repo) {
9999
rev_as_pkg_version <- function(rev) {
100100
package_version(gsub("^v", "", rev))
101101
}
102+
103+
has_git <- function() {
104+
nzchar(Sys.which("git"))
105+
}

inst/WORDLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ styler
188188
sublicenses
189189
Sublicensing
190190
Sys
191+
SystemRequirements
191192
tcltk
192193
tempfile
193194
testthat

inst/hooks/exported/readme-rmd-rendered.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ if (file.exists("README.Rmd") & file.exists("README.md")) {
33
if (file.info("README.md")$mtime < file.info("README.Rmd")$mtime) {
44
rlang::abort("README.md is out of date; please re-knit README.Rmd.")
55
}
6-
6+
if (!nzchar(Sys.which("git"))) {
7+
rlang::abort("git not found on `$PATH`, hook can't be ran.")
8+
}
79
file_names_staged <- system2(
810
"git", c("diff --cached --name-only"),
911
stdout = TRUE

0 commit comments

Comments
 (0)