Skip to content
Draft
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: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# devtools (development version)

* `release_checks()` now flags when `BugReports` is missing from DESCRIPTION.

# devtools 2.5.2

* `install()` uses a new feature of `pak::local_install_deps()` to consider the current `.libPaths()` when resolving dependencies, instead of consulting only `.libPaths()[1]`. This was an unintended behavioral change introduced in 2.5.0 (#2691).
Expand Down
10 changes: 10 additions & 0 deletions R/check-devtools.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ release_checks <- function(pkg = ".", built_path = NULL) {
check_vignette_titles(pkg)
check_news_md(pkg)
check_remotes(pkg)
check_bug_reports(pkg)

cli::cat_rule()
}
Expand Down Expand Up @@ -125,6 +126,15 @@ has_dev_remotes <- function(pkg) {
!is.null(pkg[["remotes"]])
}

check_bug_reports <- function(pkg = ".") {
pkg <- as.package(pkg)
check_status(
!is.null(pkg[["bugreports"]]),
"DESCRIPTION has a BugReports field",
"DESCRIPTION is missing a BugReports field."
)
}

check_status <- function(status, name, warning) {
cat("Checking ", name, "...", sep = "")

Expand Down
16 changes: 16 additions & 0 deletions tests/testthat/_snaps/check-devtools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# check_bug_reports() passes when BugReports is present

Code
check_bug_reports(dir)
Output
Checking DESCRIPTION has a BugReports field... OK

# check_bug_reports() warns when BugReports is missing

Code
check_bug_reports(dir)
Output
Checking DESCRIPTION has a BugReports field...
Message
x WARNING: DESCRIPTION is missing a BugReports field.

14 changes: 14 additions & 0 deletions tests/testthat/test-check-devtools.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
test_that("check_bug_reports() passes when BugReports is present", {
dir <- local_package_create()
desc::desc_set(
"BugReports",
"https://github.com/example/pkg/issues",
file = dir
)
expect_snapshot(check_bug_reports(dir))
})

test_that("check_bug_reports() warns when BugReports is missing", {
dir <- local_package_create()
expect_snapshot(check_bug_reports(dir))
})
Loading