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

use cli::cli_warn() everywhere for warnings #233

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions R/plot_aggregate_loanbooks.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ plot_aggregate_loanbooks <- function(config) {
nodes_order_from_data = TRUE
)
} else {
warning("Sankey plot (by sector) cannot be generated. Skipping!")
cli::cli_warn("Sankey plot (by sector) cannot be generated. Skipping!")
}

if (!is.null(company_aggregated_alignment_net)) {
Expand Down Expand Up @@ -198,7 +198,7 @@ plot_aggregate_loanbooks <- function(config) {
png_name = glue::glue("plot_{output_file_sankey_company_sector}.png")
)
} else {
warning("Sankey plot (by sector and company) cannot be generated. Skipping!")
cli::cli_warn("Sankey plot (by sector and company) cannot be generated. Skipping!")
}

### scatter plot alignment by exposure and sector comparison----
Expand Down Expand Up @@ -252,7 +252,7 @@ plot_aggregate_loanbooks <- function(config) {
)
}
} else {
warning("Scatter plot exposure by alignment cannot be generated. Skipping!")
cli::cli_warn("Scatter plot exposure by alignment cannot be generated. Skipping!")
}

### scatter plot for group level comparison----
Expand Down Expand Up @@ -311,9 +311,7 @@ plot_aggregate_loanbooks <- function(config) {
)
}
} else {
warning(
glue::glue("Scatter plot BO/PO cannot be generated. Skipping!")
)
cli::cli_warn("Scatter plot BO/PO cannot be generated. Skipping!")
}

# power
Expand Down Expand Up @@ -369,9 +367,7 @@ plot_aggregate_loanbooks <- function(config) {
)
}
} else {
warning(
glue::glue("Scatter plot BO/PO cannot be generated. Skipping!")
)
cli::cli_warn("Scatter plot BO/PO cannot be generated. Skipping!")
}

# group level plots ----
Expand Down Expand Up @@ -466,9 +462,7 @@ plot_aggregate_loanbooks <- function(config) {
}
}
} else {
warning(
glue::glue("Scatter plot BO/PO cannot be generated at company level. Skipping!")
)
cli::cli_warn("Scatter plot BO/PO cannot be generated at company level. Skipping!")
}

# power
Expand Down Expand Up @@ -532,8 +526,6 @@ plot_aggregate_loanbooks <- function(config) {
}
}
} else {
warning(
glue::glue("Scatter plot BO/PO cannot be generated at company level. Skipping!")
)
cli::cli_warn("Scatter plot BO/PO cannot be generated at company level. Skipping!")
}
}
2 changes: 1 addition & 1 deletion R/plot_scatter.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ plot_scatter <- function(data,
caption <- glue::glue("{caption}Region: {r2dii.plot::to_title(region)}", .trim = FALSE)
}
} else {
rlang::warn("No information to display in caption provided. Please provide scenario_source and/or scenario and/or region if you want them to be included in the graph", frequency = "once")
cli::cli_warn("No information to display in caption provided. Please provide scenario_source and/or scenario and/or region if you want them to be included in the graph", frequency = "once")
}

if (is.null(title)) {
Expand Down
2 changes: 1 addition & 1 deletion R/prepare_sector_split.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ prepare_sector_split <- function(config) {
config <- load_config(config)

if (!get_apply_sector_split(config)) {
warning("`apply_sector_split` is `FALSE` in your config, so the `prepare_sector_split()` function will do nothing.")
cli::cli_warn("{.arg apply_sector_split} is {.val FALSE} in your config, so the {.fn prepare_sector_split} function will do nothing.")
return(invisible())
}

Expand Down