Skip to content

Commit

Permalink
Lints + add comment to use vctrs::vec_case_match() when available r…
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Jun 19, 2024
1 parent 557e2e8 commit 166360e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/dt_row_groups.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dt_row_groups_init <- function(data) {

stub_df <- dt_stub_df_get(data = data)

if (any(!is.na(stub_df[["group_id"]]))) {
if (!all(is.na(stub_df[["group_id"]]))) {
row_groups <- unique(stub_df[["group_id"]])
} else {
row_groups <- character(0L)
Expand Down
2 changes: 1 addition & 1 deletion R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ gtsave_filename <- function(path, filename) {

# The use of `fs::path_abs()` works around
# the saving code in `htmltools::save_html()`
# See htmltools Issue #165 for more details
# See rstudio/htmltools#165 for more details
as.character(
fs::path_expand(
fs::path_abs(
Expand Down
6 changes: 3 additions & 3 deletions R/format_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -7832,7 +7832,7 @@ get_localized_duration_patterns <- function(
grepl("type", colnames(durations), fixed = TRUE)
] %>%
dplyr::filter(type == .env$type) %>%
dplyr::select(-type)
dplyr::select(-"type")

colnames(pattern_tbl) <- gsub("(duration|-|unitPattern-count)", "", colnames(pattern_tbl))

Expand Down Expand Up @@ -8788,7 +8788,7 @@ format_tf_by_context <- function(

make_span_with_color <- function(text, color = NULL) {

if (is.null(color) | is.null(text) | is.na(color)) {
if (is.null(color) || is.null(text) || is.na(color)) {
return(text)
}

Expand Down Expand Up @@ -11075,7 +11075,7 @@ fmt_image <- function(
#

# If width & height not provided, default width to '2em' and let width scale
if (is.null(height) & is.null(width)) {
if (is.null(height) && is.null(width)) {
height <- "2em"
}

Expand Down
1 change: 1 addition & 0 deletions R/text_transform.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ text_case_match <- function(
# a character base class (like fontawesome icons) become
# stripped of other classes and acceptable input for
# the `case_match()` function
# See https://github.com/r-lib/vctrs/issues/1622 for vctrs::vec_case_match
for (i in seq_along(x_list)) {

x_list[[i]] <- rlang::set_env(x_list[[i]])
Expand Down

0 comments on commit 166360e

Please # to comment.