-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of invalid _pkgdown.yaml
* Error, regardless of whether we're on CI or not (#2055) * New `check_pkgdown()` for lightweight check of validity (#2056).
- Loading branch information
Showing
15 changed files
with
147 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#' Check `_pkgdown.yml` | ||
#' | ||
#' Check that your `_pkgdown.yml` is valid without building the whole | ||
#' site. | ||
#' | ||
#' @export | ||
#' @inheritParams as_pkgdown | ||
check_pkgdown <- function(pkg = ".") { | ||
pkg <- as_pkgdown(pkg) | ||
|
||
data_open_graph(pkg) | ||
data_articles_index(pkg) | ||
data_reference_index(pkg) | ||
|
||
inform("No problems found") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# fails if reference index incomplete | ||
|
||
Code | ||
check_pkgdown(pkg) | ||
Condition | ||
Error in `check_missing_topics()`: | ||
! All topics must be included in reference index | ||
* Missing topics: ? | ||
|
||
# fails if article index incomplete | ||
|
||
Code | ||
check_pkgdown(pkg) | ||
Condition | ||
Error in `data_articles_index()`: | ||
! Vignettes missing from index: | ||
|
||
# informs if everything is ok | ||
|
||
Code | ||
check_pkgdown(pkg) | ||
Message | ||
No problems found | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
test_that("fails if reference index incomplete", { | ||
pkg <- local_pkgdown_site(test_path("assets/reference"), meta = " | ||
reference: | ||
- title: Title | ||
contents: [a, b, c, e] | ||
") | ||
expect_snapshot(check_pkgdown(pkg), error = TRUE) | ||
}) | ||
|
||
|
||
test_that("fails if article index incomplete", { | ||
pkg <- local_pkgdown_site(test_path("assets/articles"), meta = " | ||
articles: | ||
- title: Title | ||
contents: [starts_with('html'), standard, toc-false, widget] | ||
") | ||
expect_snapshot(check_pkgdown(pkg), error = TRUE) | ||
}) | ||
|
||
test_that("informs if everything is ok", { | ||
pkg <- local_pkgdown_site(test_path("assets/reference")) | ||
expect_snapshot(check_pkgdown(pkg)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters