Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated messages to use cli. #1151

Closed
wants to merge 1 commit into from

Conversation

shum461
Copy link
Contributor

@shum461 shum461 commented Aug 15, 2024

Fixes #1139

Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A strong start! I've suggested some changes that should resolve the test failures we see here. :)


cli::cli_warn(
"{.val {min_child_weight}} samples were requested but there were {.val {n}}
rows in the data. Therefore {.val {n}} will be used"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rows in the data. Therefore {.val {n}} will be used"
rows in the data. Therefore {.val {n}} will be used."

Comment on lines +375 to +378
cli::cli_abort(
"The option `counts = TRUE` was used but parameter {.arg nm},
was given as signif(x, 3).Please use a value >= 1
or set {.code counts = FALSE}."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cli::cli_abort(
"The option `counts = TRUE` was used but parameter {.arg nm},
was given as signif(x, 3).Please use a value >= 1
or set {.code counts = FALSE}."
cli::cli_abort(
"The option `counts = TRUE` was used but parameter {.arg nm},
was given as signif(x, 3). Please use a value >= 1
or set {.code counts = FALSE}."

I'm seeing package tests failing related to this test:

Error in `maybe_proportion(x, nm)`: The option `counts = TRUE` was used but parameter `nm`, was given as signif(x, 3).Please use a value >= 1 or set `counts = FALSE`.

Could you transition that test from using expect_error() to expect_snapshot(error = TRUE, ...)?

cli::cli_warn(
c(
"{.val {minCases}} samples were requested but there were {.val {n}} rows in the data.",
"Therefore {.val {n}} will be used"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Therefore {.val {n}} will be used"
"{.val {n}} will be used."

}

if (!is.null(early_stop)) {
if (early_stop <= 1) {
rlang::abort(paste0("`early_stop` should be on [2, ", nrounds, ")."))
cli::cli_abort("{.arg early_stop} should be on {.val [2,{nrounds})}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cli::cli_abort("{.arg early_stop} should be on {.val [2,{nrounds})}")
cli::cli_abort("{.arg early_stop} should be on {.val [2, {nrounds})}.")

} else if (early_stop >= nrounds) {
early_stop <- nrounds - 1
rlang::warn(paste0("`early_stop` was reduced to ", early_stop, "."))
cli::cli_warn("{.arg early_stop} was reduced to {.val {early_stop}}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cli::cli_warn("{.arg early_stop} was reduced to {.val {early_stop}}")
cli::cli_warn("{.arg early_stop} was reduced to {.val {early_stop}}.")

Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, meant to leave the review as a Comment!

@simonpcouch
Copy link
Contributor

@shum461, do you have interest in working on those suggested changes or would you prefer we take it from here?

@simonpcouch
Copy link
Contributor

Will go ahead and close. Thank you for the PR!

Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use cli errors in R/bart.R, R/boost_tree.R, R/decision_tree.R, and R/gen_additive_mod.R
2 participants