From 4763c820510c50b71f5c3ec22a048a9fd66902e2 Mon Sep 17 00:00:00 2001 From: Tim Nonet Date: Tue, 2 Aug 2022 08:10:05 -0500 Subject: [PATCH 1/9] Add root to remaining hooks. Issues with roxygenize tests --- .../exported/codemeta-description-updated.R | 16 ++++ inst/hooks/exported/roxygenize.R | 6 +- inst/hooks/exported/use-tidy-description.R | 20 ++++ tests/testthat/test-hooks.R | 96 ++++++++++++++++++- 4 files changed, 135 insertions(+), 3 deletions(-) diff --git a/inst/hooks/exported/codemeta-description-updated.R b/inst/hooks/exported/codemeta-description-updated.R index 313ba738a..e2022ed58 100755 --- a/inst/hooks/exported/codemeta-description-updated.R +++ b/inst/hooks/exported/codemeta-description-updated.R @@ -1,5 +1,21 @@ #!/usr/bin/env Rscript +"A hook to make sure DESCRIPTION hasn’t been edited more recently than +codemeta.json. + +Usage: + codemeta-description-updated [--root=] <_ignored>... + +Options: + --root= Path relative to the git root that contains the R package + root [default: .]. + +" -> doc + + +arguments <- docopt::docopt(doc) +setwd(arguments$root) + # adapted from https://github.com/lorenzwalthert/precommit/blob/f4413cfe6282c84f7176160d06e1560860c8bd3d/inst/hooks/exported/readme-rmd-rendered if (!file.exists("DESCRIPTION")) { rlang::abort("No `DESCRIPTION` found in repository.") diff --git a/inst/hooks/exported/roxygenize.R b/inst/hooks/exported/roxygenize.R index c0b30f421..e74a9eec6 100755 --- a/inst/hooks/exported/roxygenize.R +++ b/inst/hooks/exported/roxygenize.R @@ -14,13 +14,17 @@ This check should run *after* check that modify the files that are passed to them (like styler) because they will never modify their input .R files. Usage: - roxygenize [--no-warn-cache] ... + roxygenize [--no-warn-cache] [--root=] ... Options: --no-warn-cache Suppress the warning about a missing permanent cache. + --root= Path relative to the git root that contains the R package root [default: .]. " -> doc arguments <- docopt::docopt(doc) +arguments$files <- normalizePath(arguments$files) # because working directory changes to root +setwd(arguments$root) + if (packageVersion("precommit") < "0.1.3.9010") { rlang::abort(paste( "This hooks only works with the R package {precommit} >= 0.1.3.9010", diff --git a/inst/hooks/exported/use-tidy-description.R b/inst/hooks/exported/use-tidy-description.R index e5903e054..2eaabddfd 100755 --- a/inst/hooks/exported/use-tidy-description.R +++ b/inst/hooks/exported/use-tidy-description.R @@ -1,4 +1,24 @@ #!/usr/bin/env Rscript + +"A hook to run usethis::use_tidy_description() to ensure dependencies are +ordered alphabetically and fields are in standard order. + +Usage: + use-tidy-description [--root=] <_ignored>... + +Options: + --root= Path relative to the git root that contains the R package root [default: .]. + +" -> doc + + +arguments <- docopt::docopt(doc) +setwd(arguments$root) + +if (!file.exists("DESCRIPTION")) { + rlang::abort("No `DESCRIPTION` found in repository.") +} + description <- desc::description$new() description_old <- description$clone(deep = TRUE) deps <- description$get_deps() diff --git a/tests/testthat/test-hooks.R b/tests/testthat/test-hooks.R index de1fd9956..7a3767c9a 100644 --- a/tests/testthat/test-hooks.R +++ b/tests/testthat/test-hooks.R @@ -4,6 +4,24 @@ # success run_test("use-tidy-description", "DESCRIPTION", suffix = "") +# in sub directory with correct root +run_test("use-tidy-description", + "DESCRIPTION", + suffix = "", + cmd_args="--root=rpkg", + artifacts = c("rpkg/DESCRIPTION" = test_path("in/DESCRIPTION"))) + + + +# in sub directory with incorrect root +# Need to generate the directoy `rpkg` but without DESCRIPTION file. +run_test("use-tidy-description", + "DESCRIPTION", + suffix = "", + cmd_args="--root=rpkg", + std_err="No `DESCRIPTION` found in repository.", + artifacts = c("rpkg/README.md" = test_path("in/README.md"))) + ### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. ### style-files #### @@ -373,20 +391,58 @@ run_test("roxygenize", } ) +# with outdated Rd present in correct root +run_test("roxygenize", + file_name = c("rpkg/man/flie.Rd" = "flie.Rd"), + suffix = "", + std_err = NA, + cmd_args="--root=rpkg", + std_out = "Writing NAMESPACE", + artifacts = c( + "rpkg/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"), + "rpkg/R/roxygenize.R" = test_path("in/roxygenize.R") + ), + file_transformer = function(files) { + git_init() + git2r::add(path = files) + # hack to add artifact to trigger diff_requires_roxygenize() + git2r::add(path = fs::path(fs::path_dir(fs::path_dir(files[1])), "rpkg/R")) + files + } +) + # without Rd present run_test("roxygenize", - file_name = c("R/roxygenize.R" = "roxygenize.R"), + file_name = c("rpkg1/R/roxygenize.R" = "roxygenize.R"), suffix = "", + cmd_args="--root=rpkg1", std_err = "Please commit the new `.Rd` files", artifacts = c( - "DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf") + "rpkg1/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"), + "rpkg2/R/roxygenize.R" = test_path("in/roxygenize.R") ), file_transformer = function(files) { git_init() git2r::add(path = files) files } + +) + +# with Rd present in wrong root +run_test("roxygenize", + file_name = c("R/roxygenize.R" = "roxygenize.R"), + suffix = "", + std_err = "Please commit the new `.Rd` files", + artifacts = c( + "DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf") + ), + file_transformer = function(files) { + git_init() + git2r::add(path = files) + files + } ) @@ -458,6 +514,42 @@ run_test("codemeta-description-update", } ) +# succeed in correct root +run_test("codemeta-description-update", + file_name = c("rpkg/DESCRIPTION" = "DESCRIPTION", + "rpkg/codemeta.json" = "codemeta.json"), + cmd_args="--root=rpkg", + suffix = "", + file_transformer = function(files) { + if (length(files) > 1) { + # transformer is called once on all files and once per file + content_2 <- readLines(files[2]) + Sys.sleep(2) + writeLines(content_2, files[2]) + } + files + } +) + +# # fail in wrong root +run_test("codemeta-description-update", + file_name = c("rpkg/DESCRIPTION" = "DESCRIPTION", + "rpkg/codemeta.json" = "codemeta.json", + "rpkg2/codemeta.json" = "README.md"), + cmd_args="--root=rpkg2", + std_err="No `DESCRIPTION` found in repository.", + suffix = "", + file_transformer = function(files) { + if (length(files) > 1) { + # transformer is called once on all files and once per file + content_2 <- readLines(files[2]) + Sys.sleep(2) + writeLines(content_2, files[2]) + } + files + } +) + ### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. ### readme-rmd-rendered #### if (has_git()) { From 3c839943adf8ec5bc98bc80d94c4bb634107dff8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 Aug 2022 13:14:09 +0000 Subject: [PATCH 2/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../exported/codemeta-description-updated.R | 4 +- inst/hooks/exported/use-tidy-description.R | 2 +- tests/testthat/test-hooks.R | 137 +++++++++--------- 3 files changed, 74 insertions(+), 69 deletions(-) diff --git a/inst/hooks/exported/codemeta-description-updated.R b/inst/hooks/exported/codemeta-description-updated.R index e2022ed58..c0a155126 100755 --- a/inst/hooks/exported/codemeta-description-updated.R +++ b/inst/hooks/exported/codemeta-description-updated.R @@ -1,13 +1,13 @@ #!/usr/bin/env Rscript -"A hook to make sure DESCRIPTION hasn’t been edited more recently than +"A hook to make sure DESCRIPTION hasn’t been edited more recently than codemeta.json. Usage: codemeta-description-updated [--root=] <_ignored>... Options: - --root= Path relative to the git root that contains the R package + --root= Path relative to the git root that contains the R package root [default: .]. " -> doc diff --git a/inst/hooks/exported/use-tidy-description.R b/inst/hooks/exported/use-tidy-description.R index 2eaabddfd..46778d86c 100755 --- a/inst/hooks/exported/use-tidy-description.R +++ b/inst/hooks/exported/use-tidy-description.R @@ -1,6 +1,6 @@ #!/usr/bin/env Rscript -"A hook to run usethis::use_tidy_description() to ensure dependencies are +"A hook to run usethis::use_tidy_description() to ensure dependencies are ordered alphabetically and fields are in standard order. Usage: diff --git a/tests/testthat/test-hooks.R b/tests/testthat/test-hooks.R index 7a3767c9a..db8557f45 100644 --- a/tests/testthat/test-hooks.R +++ b/tests/testthat/test-hooks.R @@ -6,21 +6,23 @@ run_test("use-tidy-description", "DESCRIPTION", suffix = "") # in sub directory with correct root run_test("use-tidy-description", - "DESCRIPTION", - suffix = "", - cmd_args="--root=rpkg", - artifacts = c("rpkg/DESCRIPTION" = test_path("in/DESCRIPTION"))) + "DESCRIPTION", + suffix = "", + cmd_args = "--root=rpkg", + artifacts = c("rpkg/DESCRIPTION" = test_path("in/DESCRIPTION")) +) # in sub directory with incorrect root # Need to generate the directoy `rpkg` but without DESCRIPTION file. run_test("use-tidy-description", - "DESCRIPTION", - suffix = "", - cmd_args="--root=rpkg", - std_err="No `DESCRIPTION` found in repository.", - artifacts = c("rpkg/README.md" = test_path("in/README.md"))) + "DESCRIPTION", + suffix = "", + cmd_args = "--root=rpkg", + std_err = "No `DESCRIPTION` found in repository.", + artifacts = c("rpkg/README.md" = test_path("in/README.md")) +) ### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. ### style-files #### @@ -393,22 +395,22 @@ run_test("roxygenize", # with outdated Rd present in correct root run_test("roxygenize", - file_name = c("rpkg/man/flie.Rd" = "flie.Rd"), - suffix = "", - std_err = NA, - cmd_args="--root=rpkg", - std_out = "Writing NAMESPACE", - artifacts = c( - "rpkg/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"), - "rpkg/R/roxygenize.R" = test_path("in/roxygenize.R") - ), - file_transformer = function(files) { - git_init() - git2r::add(path = files) - # hack to add artifact to trigger diff_requires_roxygenize() - git2r::add(path = fs::path(fs::path_dir(fs::path_dir(files[1])), "rpkg/R")) - files - } + file_name = c("rpkg/man/flie.Rd" = "flie.Rd"), + suffix = "", + std_err = NA, + cmd_args = "--root=rpkg", + std_out = "Writing NAMESPACE", + artifacts = c( + "rpkg/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"), + "rpkg/R/roxygenize.R" = test_path("in/roxygenize.R") + ), + file_transformer = function(files) { + git_init() + git2r::add(path = files) + # hack to add artifact to trigger diff_requires_roxygenize() + git2r::add(path = fs::path(fs::path_dir(fs::path_dir(files[1])), "rpkg/R")) + files + } ) @@ -416,7 +418,7 @@ run_test("roxygenize", run_test("roxygenize", file_name = c("rpkg1/R/roxygenize.R" = "roxygenize.R"), suffix = "", - cmd_args="--root=rpkg1", + cmd_args = "--root=rpkg1", std_err = "Please commit the new `.Rd` files", artifacts = c( "rpkg1/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"), @@ -427,22 +429,21 @@ run_test("roxygenize", git2r::add(path = files) files } - ) # with Rd present in wrong root run_test("roxygenize", - file_name = c("R/roxygenize.R" = "roxygenize.R"), - suffix = "", - std_err = "Please commit the new `.Rd` files", - artifacts = c( - "DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf") - ), - file_transformer = function(files) { - git_init() - git2r::add(path = files) - files - } + file_name = c("R/roxygenize.R" = "roxygenize.R"), + suffix = "", + std_err = "Please commit the new `.Rd` files", + artifacts = c( + "DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf") + ), + file_transformer = function(files) { + git_init() + git2r::add(path = files) + files + } ) @@ -516,38 +517,42 @@ run_test("codemeta-description-update", # succeed in correct root run_test("codemeta-description-update", - file_name = c("rpkg/DESCRIPTION" = "DESCRIPTION", - "rpkg/codemeta.json" = "codemeta.json"), - cmd_args="--root=rpkg", - suffix = "", - file_transformer = function(files) { - if (length(files) > 1) { - # transformer is called once on all files and once per file - content_2 <- readLines(files[2]) - Sys.sleep(2) - writeLines(content_2, files[2]) - } - files - } + file_name = c( + "rpkg/DESCRIPTION" = "DESCRIPTION", + "rpkg/codemeta.json" = "codemeta.json" + ), + cmd_args = "--root=rpkg", + suffix = "", + file_transformer = function(files) { + if (length(files) > 1) { + # transformer is called once on all files and once per file + content_2 <- readLines(files[2]) + Sys.sleep(2) + writeLines(content_2, files[2]) + } + files + } ) # # fail in wrong root run_test("codemeta-description-update", - file_name = c("rpkg/DESCRIPTION" = "DESCRIPTION", - "rpkg/codemeta.json" = "codemeta.json", - "rpkg2/codemeta.json" = "README.md"), - cmd_args="--root=rpkg2", - std_err="No `DESCRIPTION` found in repository.", - suffix = "", - file_transformer = function(files) { - if (length(files) > 1) { - # transformer is called once on all files and once per file - content_2 <- readLines(files[2]) - Sys.sleep(2) - writeLines(content_2, files[2]) - } - files - } + file_name = c( + "rpkg/DESCRIPTION" = "DESCRIPTION", + "rpkg/codemeta.json" = "codemeta.json", + "rpkg2/codemeta.json" = "README.md" + ), + cmd_args = "--root=rpkg2", + std_err = "No `DESCRIPTION` found in repository.", + suffix = "", + file_transformer = function(files) { + if (length(files) > 1) { + # transformer is called once on all files and once per file + content_2 <- readLines(files[2]) + Sys.sleep(2) + writeLines(content_2, files[2]) + } + files + } ) ### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. From 47c381a76a97cae272c3e7653e30227620693d6f Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sat, 13 Aug 2022 19:29:25 +0200 Subject: [PATCH 3/9] here::here() is dangerous after setwd() and git2r::status() does not list all files in staged, so let's just use plain file filter for new repo --- API | 2 +- DESCRIPTION | 2 +- R/roxygen2.R | 8 ++++---- man/diff_requires_run_roxygenize.Rd | 2 +- man/extract_diff_root.Rd | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/API b/API index 7ab80fe95..bef9c6cd4 100644 --- a/API +++ b/API @@ -3,7 +3,7 @@ ## Exported functions autoupdate(root = here::here()) -diff_requires_run_roxygenize(root = here::here()) +diff_requires_run_roxygenize(root = ".") dirs_R.cache(hook_id) install_precommit(force = FALSE) may_require_permanent_cache(temp_cache_is_enough = FALSE) diff --git a/DESCRIPTION b/DESCRIPTION index e065e2241..71e0f603d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -48,5 +48,5 @@ Roxygen: list(markdown = TRUE, roclets = c( "rd", "namespace", "collate", if (rlang::is_installed("pkgapi")) "pkgapi::api_roclet" else { warning("Please install r-lib/pkgapi to make sure the file API is kept up to date"); NULL} ) ) -RoxygenNote: 7.2.0 +RoxygenNote: 7.2.1 SystemRequirements: git diff --git a/R/roxygen2.R b/R/roxygen2.R index 2388570f0..4d89327f6 100644 --- a/R/roxygen2.R +++ b/R/roxygen2.R @@ -24,14 +24,14 @@ extract_diff_files <- function(files) { #' hook such as [roxygen2::roxygenize()] must run at all or not. #' @param root The root of project. #' @keywords internal -extract_diff_root <- function(root = here::here()) { +extract_diff_root <- function(root = ".") { assert_is_git_repo(root) repo <- git2r::repository(root) if (length(git2r::reflog(repo)) == 0) { # nothing committed yet - all_files <- git2r::status()$staged + all_r_source_files <- list.files("R/", full.names = TRUE) - purrr::map(all_files[grepl("^R/.*\\.[Rr]$", all_files)], readLines) %>% + purrr::map(all_r_source_files, readLines) %>% unlist() %>% unname() } else { @@ -57,7 +57,7 @@ extract_diff_root <- function(root = here::here()) { #' diff_requires_run_roxygenize() #' } #' @export -diff_requires_run_roxygenize <- function(root = here::here()) { +diff_requires_run_roxygenize <- function(root = ".") { if (rlang::with_handlers(withr::with_namespace("git2r", FALSE), error = function(...) TRUE)) { generic <- paste0( " Please add the package as a dependency to ", diff --git a/man/diff_requires_run_roxygenize.Rd b/man/diff_requires_run_roxygenize.Rd index ae71ad474..e6246fd5b 100644 --- a/man/diff_requires_run_roxygenize.Rd +++ b/man/diff_requires_run_roxygenize.Rd @@ -4,7 +4,7 @@ \alias{diff_requires_run_roxygenize} \title{Check if we should run roxygen.} \usage{ -diff_requires_run_roxygenize(root = here::here()) +diff_requires_run_roxygenize(root = ".") } \arguments{ \item{root}{The root of project.} diff --git a/man/extract_diff_root.Rd b/man/extract_diff_root.Rd index c9138fe81..30d775047 100644 --- a/man/extract_diff_root.Rd +++ b/man/extract_diff_root.Rd @@ -4,7 +4,7 @@ \alias{extract_diff_root} \title{Extract old and new lines from \verb{git diff --cached}} \usage{ -extract_diff_root(root = here::here()) +extract_diff_root(root = ".") } \arguments{ \item{root}{The root of project.} From bb6eaab8586e27205d85e2ce1fd67bbc585e4f00 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sat, 13 Aug 2022 19:30:02 +0200 Subject: [PATCH 4/9] files are passed to hook script, so we need to capture --- inst/hooks/exported/codemeta-description-updated.R | 2 +- inst/hooks/exported/use-tidy-description.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/hooks/exported/codemeta-description-updated.R b/inst/hooks/exported/codemeta-description-updated.R index c0a155126..eed0ad831 100755 --- a/inst/hooks/exported/codemeta-description-updated.R +++ b/inst/hooks/exported/codemeta-description-updated.R @@ -4,7 +4,7 @@ codemeta.json. Usage: - codemeta-description-updated [--root=] <_ignored>... + codemeta-description-updated [--root=] ... Options: --root= Path relative to the git root that contains the R package diff --git a/inst/hooks/exported/use-tidy-description.R b/inst/hooks/exported/use-tidy-description.R index 46778d86c..f141afe05 100755 --- a/inst/hooks/exported/use-tidy-description.R +++ b/inst/hooks/exported/use-tidy-description.R @@ -4,7 +4,7 @@ ordered alphabetically and fields are in standard order. Usage: - use-tidy-description [--root=] <_ignored>... + use-tidy-description [--root=] ... Options: --root= Path relative to the git root that contains the R package root [default: .]. From de61ac9a99c94f540b0ec19cb25f14b22b48ed08 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sat, 13 Aug 2022 19:30:15 +0200 Subject: [PATCH 5/9] random roxygen --- man/git_init.Rd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man/git_init.Rd b/man/git_init.Rd index 5ad97130f..10de1b6e1 100644 --- a/man/git_init.Rd +++ b/man/git_init.Rd @@ -6,6 +6,9 @@ \usage{ git_init(path = ".") } +\arguments{ +\item{path}{A path to where to init a git repository} +} \description{ In particular, to avoid CRAN errors \href{https://github.com/lorenzwalthert/precommit/issues/320}{lorenzwalthert/precommit#320}. From 96977b3a26b7216e33a8088777f242d777e5a622 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sat, 13 Aug 2022 20:10:18 +0200 Subject: [PATCH 6/9] rollback and fix at source: right git dir --- R/roxygen2.R | 4 ++-- tests/testthat/test-hooks.R | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/R/roxygen2.R b/R/roxygen2.R index 4d89327f6..19d2a5c9c 100644 --- a/R/roxygen2.R +++ b/R/roxygen2.R @@ -29,9 +29,9 @@ extract_diff_root <- function(root = ".") { repo <- git2r::repository(root) if (length(git2r::reflog(repo)) == 0) { # nothing committed yet - all_r_source_files <- list.files("R/", full.names = TRUE) + all_files <- git2r::status()$staged - purrr::map(all_r_source_files, readLines) %>% + purrr::map(all_files[grepl("^R/.*\\.[Rr]$", all_files)], readLines) %>% unlist() %>% unname() } else { diff --git a/tests/testthat/test-hooks.R b/tests/testthat/test-hooks.R index db8557f45..5cd3a4763 100644 --- a/tests/testthat/test-hooks.R +++ b/tests/testthat/test-hooks.R @@ -405,10 +405,11 @@ run_test("roxygenize", "rpkg/R/roxygenize.R" = test_path("in/roxygenize.R") ), file_transformer = function(files) { + withr::local_dir("rpkg") git_init() git2r::add(path = files) # hack to add artifact to trigger diff_requires_roxygenize() - git2r::add(path = fs::path(fs::path_dir(fs::path_dir(files[1])), "rpkg/R")) + git2r::add(path = fs::path(fs::path_dir(fs::path_dir(files[1])), "R")) files } ) @@ -425,6 +426,7 @@ run_test("roxygenize", "rpkg2/R/roxygenize.R" = test_path("in/roxygenize.R") ), file_transformer = function(files) { + withr::local_dir("rpkg1") git_init() git2r::add(path = files) files From f36ad760bc0b30e3e1b4ab20842148fc717001dd Mon Sep 17 00:00:00 2001 From: Tim Nonet Date: Sun, 14 Aug 2022 11:13:42 -0500 Subject: [PATCH 7/9] Update docs with new "root" argument --- vignettes/available-hooks.Rmd | 44 ++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/vignettes/available-hooks.Rmd b/vignettes/available-hooks.Rmd index 37735f0f5..083f0ce54 100644 --- a/vignettes/available-hooks.Rmd +++ b/vignettes/available-hooks.Rmd @@ -223,6 +223,22 @@ This hook does not modify input files, but writes to `.Rd` files in `man/`, `NAMESPACE` and potentially others depending on which roxygen roclets you specified in `DESCRIPTION`. + +**Arguments** + + + + id: roxygenize + args: [--root=] + + +- Argument `root` 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. Added in version + 0.3.3.00000. + + + ## `deps-in-desc` Checks if packages used with the `pkgname::fun()` syntax are listed in @@ -248,7 +264,7 @@ your DESCRIPTION file. Note that `README.Rmd` is never checked. id: deps-in-desc - args: [--root=] + args: [--root=] This hook does not modify the file `DESCRIPTION` because the user should decide for each package if it should go to `Imports:` or `Suggests:`, @@ -261,6 +277,19 @@ are ordered alphabetically and fields are in standard order. This hook does modify the file `DESCRIPTION`. +**Arguments** + + + + id: use-tidy-description + args: [--root=] + + +- Argument `root` 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. Added in version + 0.3.3.00000. + ## `lintr` A hook to run `lintr::lint()` to check that R files are lint free. @@ -288,3 +317,16 @@ i.e. remind you to run `codemetar::write_codemeta()` in order to keep `codemeta.json` in sync with `DESCRIPTION`. This hook does not modify any file. + +**Arguments** + + + + id: codemeta-description-updated + args: [--root=] + + +- Argument `root` 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. Added in version + 0.3.3.00000. From c55432b0396cdd8af65017efe5ee28e8927cf043 Mon Sep 17 00:00:00 2001 From: Tim Nonet Date: Sun, 14 Aug 2022 11:19:33 -0500 Subject: [PATCH 8/9] Update NEWS.md --- NEWS.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS.md b/NEWS.md index 7c325f0e4..3ed75fc6a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,10 +4,20 @@ editor_options: wrap: 72 --- +# precommit v0.3.3 +- `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. + # precommit v0.3.2.9000 - `use_ci()` is now documented to take `NA`, not `NULL` for argument `ci` (#431). +- `deps-in-desc`supports 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. # precommit v0.3.2 From 6cfb61835ffabbbb6fa46fc762e9372fc998634b Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sun, 14 Aug 2022 18:24:11 +0200 Subject: [PATCH 9/9] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 3ed75fc6a..c51c25794 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ editor_options: wrap: 72 --- -# precommit v0.3.3 +# precommit v0.3.2.9001 (Development version) - `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.