Skip to content

Commit

Permalink
feat: make handle_arg_x_nm redact long x_nm
Browse files Browse the repository at this point in the history
  • Loading branch information
WetRobot committed Jan 22, 2024
1 parent ff821c2 commit c9d08a2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ New exported function `dbc::generate_script_from_expressions`.
This function is used to produce all generated expression-based functions
in `dbc`.

### dbc::handle_arg_x_nm

`dbc::handle_arg_x_nm` now redacts `x_nm` if it is longer than 50
characters.

### dbc::handle_args_inplace

New exported function `dbc::handle_args_inplace`.
Expand Down
10 changes: 10 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ handle_arg_x_nm <- function(x_nm, env = NULL, arg_nm = "x") {
collapse = ""
)
}
# @codedoc_comment_block news("dbc::handle_arg_x_nm", "2024-01-22", "0.5.0")
# `dbc::handle_arg_x_nm` now redacts `x_nm` if it is longer than 50
# characters.
# @codedoc_comment_block news("dbc::handle_arg_x_nm", "2024-01-22", "0.5.0")
nc <- nchar(x_nm)
if (nc > 50) {
head <- substr(x_nm, 1, 22)
tail <- substr(x_nm, nc - 22, nc)
x_nm <- paste0(head, "[...]", tail)
}
x_nm
}

Expand Down
6 changes: 6 additions & 0 deletions man/dbc-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c9d08a2

Please sign in to comment.