Skip to content

Commit

Permalink
make deadline a value of show argument, update docs, README
Browse files Browse the repository at this point in the history
  • Loading branch information
fmichonneau committed Jul 2, 2024
1 parent 16dbc02 commit 6f751c7
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 182 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
6 changes: 3 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* The output of `cran_results()` and `summary_cran_results()` can now include
the deadline fixed by CRAN. This deadline is the date by which requested
changes need to be implemented before the package gets archived. To see any
deadline that might have been set by CRAN Maintainers, set the
`include_deadline` argument to `TRUE` (default). The value for this argument
can also be set using the local option `foghorn_include_deadline`.
deadline that might have been set by CRAN Maintainers, add (`"deadline"`) as
one of the values to the `show` argument. The value of the `show` argument
can also be controled by the local option `foghorn_columns`.
* The `cran_results()` function gains the `max_requests` argument that limits
the number of requests that are performed against the CRAN website in a single
query.
Expand Down
30 changes: 15 additions & 15 deletions R/cran_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ cran_results_web <- function(email, pkg, include_deadline, max_requests, ...) {
res_email <- read_cran_web_from_email(email, ...)
res <- cran_checks_table(res_email)
res <- add_other_issues(res, res_email)
to_fix <- deadline_pkg_web(
pkg_with_issues(res),
deadline_res <- deadline_pkg_web(
res[["package"]],
include_deadline = include_deadline,
max_requests = max_requests
)
res <- add_deadline(res, to_fix)
res <- add_deadline(res, deadline_res)
}
if (!is.null(pkg)) {
res_pkg <- read_cran_web_from_pkg(pkg, ...)
tbl_pkg <- cran_checks_table(res_pkg)
res_pkg <- add_other_issues(tbl_pkg, res_pkg)
res_pkg <- add_deadline(
res_pkg,
deadline_pkg_web(pkg, include_deadline = include_deadline, max_requests = max_requests)
deadline_pkg <- deadline_pkg_web(
pkg,
include_deadline = include_deadline,
max_requests = max_requests
)
res_pkg <- add_deadline(res_pkg, deadline_pkg)
res <- rbind(res, res_pkg)
}
res
Expand Down Expand Up @@ -58,11 +60,9 @@ cran_results_crandb <- function(email, pkg, ...) {
##' @export
##' @param email email address for package maintainers (character vector)
##' @param pkg package names (character vector)
##' @param show columns of the data frame to show (all are shown by default)
##' @param show columns of the data frame to show (all are shown by default).
##' See 'Details' for more information.
##' @template src
##' @param include_deadline if `TRUE`, the output will display the deadline set
##' by CRAN to fix the check results before the package gets archived. (See
##' Details).
##' @param max_requests maximum number of requests allowed to be performed,
##' ignored when using `src = "crandb"`. Use `Inf` to skip this check. (See
##' Details).
Expand All @@ -76,19 +76,19 @@ cran_results_crandb <- function(email, pkg, ...) {
##' cran_results(pkg="MASS")
##' }
cran_results <- function(email = NULL, pkg = NULL,
show = c("error", "fail", "warn", "note", "ok"),
show = getOption("foghorn_columns", c("error", "fail", "warn", "note", "ok", "deadline")),
src = c("website", "crandb"),
include_deadline = getOption("foghorn_include_deadline", TRUE),
max_requests = 50, ...) {

show <- tolower(show)
show <- match.arg(show, several.ok = TRUE)
show <- c("package", show, "has_other_issues", "deadline")

src <- match.arg(src, c("website", "crandb"))
show <- c("package", show, "has_other_issues")

include_deadline <- "deadline" %in% show
stopifnot(rlang::is_scalar_logical(include_deadline) && !is.na(include_deadline))

src <- match.arg(src, c("website", "crandb"))

if (is.null(email) && is.null(pkg)) {
stop(
"You need to provide at least one value for ", sQuote("email"),
Expand Down
File renamed without changes.
10 changes: 0 additions & 10 deletions R/zzz.R

This file was deleted.

83 changes: 50 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ output.
summary_cran_results(email = "[email protected]", pkg = "lme4")
#> ✔ All clear for foghorn, phylobase, and riceware!
#> ★ Packages with notes on CRAN:
#> - lme4 (8) [Fix before: 2024-06-17]
#> - lme4 (11) [Fix before: 2024-07-16]
#> - rncl (12)
#> - rotl (10)
#> ◉ Package with other issues on CRAN:
#> - lme4 [Fix before: 2024-06-17]
#> - lme4 [Fix before: 2024-07-16]
```

`summary_cran_results()` is actually an alias of
Expand All @@ -82,13 +82,13 @@ results of the CRAN checks. These results are stored in a tibble.
## Results of the checks as a tibble
cran_results(email = "[email protected]")
#> # A tibble: 5 × 8
#> package error fail warn note ok has_other_issues fix_before
#> <chr> <int> <int> <int> <int> <int> <lgl> <chr>
#> 1 foghorn 0 0 0 0 13 FALSE <NA>
#> 2 phylobase 0 0 0 0 13 FALSE <NA>
#> 3 riceware 0 0 0 0 13 FALSE <NA>
#> 4 rncl 0 0 0 12 1 FALSE <NA>
#> 5 rotl 0 0 0 10 3 FALSE <NA>
#> package error fail warn note ok deadline has_other_issues
#> <chr> <int> <int> <int> <int> <int> <chr> <lgl>
#> 1 foghorn 0 0 0 0 13 "" FALSE
#> 2 phylobase 0 0 0 0 13 "" FALSE
#> 3 riceware 0 0 0 0 13 "" FALSE
#> 4 rncl 0 0 0 12 1 "" FALSE
#> 5 rotl 0 0 0 10 3 "" FALSE
```

In addition of your own packages, you can also check the results for any
Expand All @@ -106,10 +106,10 @@ summary_cran_results(pkg = c("ggplot2", "dplyr"))

cran_results(pkg = c("ggplot2", "dplyr"))
#> # A tibble: 2 × 8
#> package error fail warn note ok has_other_issues fix_before
#> <chr> <int> <int> <int> <int> <int> <lgl> <chr>
#> 1 dplyr 0 0 0 5 8 FALSE <NA>
#> 2 ggplot2 0 0 0 8 5 FALSE <NA>
#> package error fail warn note ok deadline has_other_issues
#> <chr> <int> <int> <int> <int> <int> <chr> <lgl>
#> 1 dplyr 0 0 0 5 8 "" FALSE
#> 2 ggplot2 0 0 0 8 5 "" FALSE
```

``` r
Expand All @@ -121,14 +121,14 @@ summary_cran_results(
)
#> ✔ All clear for foghorn, phylobase, and riceware!
#> ⚠ Package with warnings on CRAN:
#> - duckdb (1)
#> - duckdb (5) [Fix before: 2024-07-10]
#> ★ Packages with notes on CRAN:
#> - arrow (11)
#> - duckdb (11)
#> - duckdb (6) [Fix before: 2024-07-10]
#> - rncl (12)
#> - rotl (10)
#> ◉ Package with other issues on CRAN:
#> - duckdb
#> - duckdb [Fix before: 2024-07-10]
```

``` r
Expand All @@ -138,15 +138,15 @@ cran_results(
pkg = c("arrow", "duckdb")
)
#> # A tibble: 7 × 8
#> package error fail warn note ok has_other_issues fix_before
#> <chr> <int> <int> <int> <int> <int> <lgl> <chr>
#> 1 arrow 0 0 0 11 2 FALSE <NA>
#> 2 duckdb 0 0 1 11 1 TRUE <NA>
#> 3 foghorn 0 0 0 0 13 FALSE <NA>
#> 4 phylobase 0 0 0 0 13 FALSE <NA>
#> 5 riceware 0 0 0 0 13 FALSE <NA>
#> 6 rncl 0 0 0 12 1 FALSE <NA>
#> 7 rotl 0 0 0 10 3 FALSE <NA>
#> package error fail warn note ok deadline has_other_issues
#> <chr> <int> <int> <int> <int> <int> <chr> <lgl>
#> 1 arrow 0 0 0 11 2 "" FALSE
#> 2 duckdb 0 0 5 6 2 "2024-07-10" TRUE
#> 3 foghorn 0 0 0 0 13 "" FALSE
#> 4 phylobase 0 0 0 0 13 "" FALSE
#> 5 riceware 0 0 0 0 13 "" FALSE
#> 6 rncl 0 0 0 12 1 "" FALSE
#> 7 rotl 0 0 0 10 3 "" FALSE
```

You can inspect the logs for the check results using
Expand All @@ -155,22 +155,21 @@ You can inspect the logs for the check results using

``` r
(tidyr_checks <- cran_details(pkg = "tidyr"))
#> # A tibble: 4 × 7
#> # A tibble: 5 × 7
#> package version result check flavors n_flavors message
#> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 tidyr 1.3.1 NOTE compiled code r-deve… 4 " …
#> 1 tidyr 1.3.1 NOTE compiled code r-deve… 2 " …
#> 2 tidyr 1.3.1 NOTE data for non-ASCII characters r-deve… 2 " …
#> 3 tidyr 1.3.1 NOTE compiled code r-deve… 2 " …
#> 4 tidyr 1.3.1 ERROR re-building of vignette outp… r-rele… 2 " …
#> 4 tidyr 1.3.1 NOTE compiled code r-deve… 2 " …
#> 5 tidyr 1.3.1 ERROR re-building of vignette outp… r-rele… 2 " …
```

``` r
summary(tidyr_checks)
#> ★ tidyr - note: compiled code
#> ❯ r-devel-linux-x86_64-debian-clang
#> ❯ r-devel-linux-x86_64-debian-gcc
#> ❯ r-devel-linux-x86_64-fedora-clang
#> ❯ r-devel-linux-x86_64-fedora-gcc
#>
#> File ‘tidyr/libs/tidyr.so’:
#> Found non-API calls to R: ‘SETLENGTH’, ‘SET_GROWABLE_BIT’,
Expand All @@ -179,6 +178,8 @@ summary(tidyr_checks)
#> Compiled code should not call non-API entry points in R.
#>
#> See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual.
#> See section ‘Moving into C API compliance’ in the ‘Writing R
#> Extensions’ manual for issues with use of non-API entry points.
#>
#> ★ tidyr - note: data for non-ASCII characters
#> ❯ r-devel-linux-x86_64-fedora-clang
Expand All @@ -187,6 +188,20 @@ summary(tidyr_checks)
#> Note: found 24 marked UTF-8 strings
#>
#> ★ tidyr - note: compiled code
#> ❯ r-devel-linux-x86_64-fedora-clang
#> ❯ r-devel-linux-x86_64-fedora-gcc
#>
#> File ‘tidyr/libs/tidyr.so’:
#> Found non-API calls to R: ‘SETLENGTH’, ‘SET_GROWABLE_BIT’,
#> ‘SET_TRUELENGTH’
#>
#> Compiled code should not call non-API entry points in R.
#>
#> See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual,
#> and section ‘Moving into C API compliance’ for issues with the use of
#> non-API entry points.
#>
#> ★ tidyr - note: compiled code
#> ❯ r-devel-windows-x86_64
#>
#> File 'tidyr/libs/x64/tidyr.dll':
Expand All @@ -196,6 +211,8 @@ summary(tidyr_checks)
#> Compiled code should not call non-API entry points in R.
#>
#> See 'Writing portable packages' in the 'Writing R Extensions' manual.
#> See section 'Moving into C API compliance' in the 'Writing R
#> Extensions' manual for issues with use of non-API entry points.
#>
#> ✖ tidyr - error: re-building of vignette outputs
#> ❯ r-release-macos-arm64
Expand Down Expand Up @@ -243,9 +260,9 @@ on a large number of packages, using the CRAN database is recommended
``` r
cran_results(pkg = "nlme", src = "crandb", progress = FALSE)
#> # A tibble: 1 × 8
#> package error fail warn note ok has_other_issues fix_before
#> <chr> <int> <int> <int> <int> <int> <lgl> <chr>
#> 1 nlme 0 0 0 0 13 FALSE <NA>
#> package error fail warn note ok deadline has_other_issues
#> <chr> <int> <int> <int> <int> <int> <chr> <lgl>
#> 1 nlme 0 0 0 0 13 "" FALSE
```

Check out the “Details” section in the help files for more information.
Expand Down
19 changes: 7 additions & 12 deletions man-roxygen/details.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@
##' more requests than this limit will be performed to retrieve the results.
##'
##' The `deadline` column contains the date set by CRAN to fix issues with the
##' CRAN checks before the package gets archived. To limit the number of
##' requests to the CRAN mirror, the existence of a deadline is checked only for
##' packages where issues have been detected. If the deadline is not checked
##' (either because the argument `include_deadline` is set to `FALSE`, or
##' because there is no issues detected with the CRAN checks), the content of
##' the `deadline` column for the package will be set to `NA`. If the existence
##' of a deadline has been checked but no date has been set by the CRAN
##' Maintainers, the `deadline` column for the package will be set to `""`. If
##' there is a deadline, the content will be a date stored as `character`.
##'
##' The value of the argument `include_deadline` can be set using the
##' local option `foghorn_include_deadline`.
##' CRAN checks before the package gets archived. If the existence of a deadline
##' has been checked but no date has been set by the CRAN Maintainers, the
##' `deadline` column for the package will be set to `""`. If there is a
##' deadline, the content will be a date stored as `character`.
##'
##' The value of the argument `show` can be set using the local option
##' `foghorn_columns`.
##'
##' When choosing `src = "crandb"` you can also specify the
##' following options:
Expand Down
17 changes: 6 additions & 11 deletions man/cran_details.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 10 additions & 18 deletions man/cran_results.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6f751c7

Please sign in to comment.