Skip to content

Commit

Permalink
convert two more warnings to use cli
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Mar 23, 2024
1 parent 24248f0 commit b65b498
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Imports:
xmlparsedata (>= 1.0.5)
Suggests:
bookdown,
httr (>= 1.2.1),
jsonlite,
patrick (>= 0.2.0),
rlang,
Expand Down
9 changes: 4 additions & 5 deletions R/cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ load_cache <- function(file, path = NULL) {
invokeRestart("muffleWarning")
},
error = function(e) {
warning(
"Could not load cache file '", file, "':\n",
conditionMessage(e),
call. = FALSE
)
cli_warn(c(
x = "Could not load cache file {.file {file}}:\n",
i = conditionMessage(e)
))
}
)
} # else nothing to do for source file that has no cache
Expand Down
10 changes: 5 additions & 5 deletions R/with.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ all_linters <- function(..., packages = "lintr") {
linters_with_defaults <- function(..., defaults = default_linters) {
dots <- list(...)
if (missing(defaults) && "default" %in% names(dots)) {
warning(
"'default' is not an argument to linters_with_defaults(). Did you mean 'defaults'? ",
"This warning will be removed when with_defaults() is fully deprecated.",
call. = FALSE
)
cli_warn(c(
x = "{.arg default} is not an argument to {.fun linters_with_defaults}.",
i = "Did you mean {.arg defaults}?",
i = "This warning will be removed when {.fun with_defaults} is fully deprecated."

Check warning on line 187 in R/with.R

View workflow job for this annotation

GitHub Actions / lint

file=R/with.R,line=187,col=7,[duplicate_argument_linter] Avoid duplicate arguments in function calls.
))
defaults <- dots$default
nms <- names2(dots)
missing_index <- !nzchar(nms, keepNA = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-with.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ test_that("linters_with_defaults(default = .) is supported with a deprecation wa
{
linters <- linters_with_defaults(default = list(), whitespace_linter())
},
"'default'"
"`default` is not an argument"
)
expect_named(linters, "whitespace_linter")

Expand Down

0 comments on commit b65b498

Please sign in to comment.