Convert error, warning, and message calls to cli messaging - #800
Convert error, warning, and message calls to cli messaging#800alanahjonas95 wants to merge 24 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Escape literal braces in cli suggestions and align tests/snapshots with the cli message formatting shown in CI logs. Also replace deparse()+paste() with deparse1() to satisfy lintr. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Align the remaining apply_tfrmt/page_plan expectations with the actual cli message formatting seen in CI, and restore the big_n warning text so duplicated columns remain readable in snapshots. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cli::cli_warn() joins unnamed multi-element message vectors into a single wrapped line rather than preserving them as separate lines, so update the big_n snapshot to reflect the actual output. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
| } | ||
|
|
||
| message(paste(message_text, collapse = "\n")) | ||
| cli::cli_inform(paste(message_text, collapse = "\n")) |
There was a problem hiding this comment.
Not sure the paste() call is needed here. The formatting seems to be off a bit (no space between footnote and "Test footnote 1" and the line break after for the).
We could get a bit more sophisticated and build the message (or the message details) with bullets:
cli::cli_inform(
c(
"The provided column location does not exist in the provided data for the footnote\"Test footnote 1\"",
"i" = "Provided column location:",
"*" = "trt: `Not A Column`"
)
)
#> The provided column location does not exist in the provided data for the
#> footnote"Test footnote 1"
#> ℹ Provided column location:
#> • trt: `Not A Column`There was a problem hiding this comment.
agreed, this is nicer. I've updated the message using cli_inform() with an "i" info line and dynamically generated "*" bullets for each column/value pair
|
|
||
| if (length(miss_param_from_data) > 0) { | ||
| stop(paste0( | ||
| cli::cli_abort(paste0( |
There was a problem hiding this comment.
{cli} supports string interpolation with {glue}. Looking into this I realised this stop() / cli::cli_abort() call is not covered by unit tests.
There was a problem hiding this comment.
Converted this to cli/glue implicit interpolation and added a new unit test
| id_cols <- .tmp_data %>% | ||
| dplyr::select(!!!column, !!label, !!!group, !!param) | ||
| warning(paste0( | ||
| cli::cli_warn(paste0( |
There was a problem hiding this comment.
cli + paste or paste0 can usually be substituted with cli + implicit glue interpolation
There was a problem hiding this comment.
replaced the paste/paste0 concatenation with implicit glue interpolation. Also swept the rest of the package for any other cli + paste/paste0 call sites and converted those to implicit glue interpolation too.
- apply_footnote_meta.R: rebuild the column-location-not-found message using cli::cli_inform() with proper spacing and bullet points instead of a manually paste()-joined string. - apply_frmt_methods.R: replace paste0()/toString() concatenation in the missing-parameter cli_abort() and uniqueness cli_warn() calls with cli/glue implicit string interpolation. - Add a unit test covering the previously-untested 'parameters missing from the data' error path in apply_frmt.frmt_combine(). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…olation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🦺 Coverage summary🟢 Merging PR #800 ( DetailsFiles with changes in coverage
Coverage for modified lines
♻️ Comment updated with the latest results. Created on 2026-08-11 with covr2gh v0.0.0.9041. |
resolves #748