Showing 2 of 6 files from the diff.

@@ -26,10 +26,10 @@
Loading
26 26
#' @param when A string giving the version when the behaviour was deprecated.
27 27
#' @param what A string describing what is deprecated:
28 28
#'
29 -
#'   * Deprecate a whole function with `"foo()"`.
30 -
#'   * Deprecate an argument with `"foo(arg)"`.
29 +
#'   * Deprecate a whole function with `foo()`.
30 +
#'   * Deprecate an argument with `foo(arg)`.
31 31
#'   * Partially deprecate an argument with
32 -
#'     `"foo(arg = 'must be a scalar integer')"`.
32 +
#'     `foo(arg = 'must be a scalar integer')`.
33 33
#'
34 34
#'   You can optionally supply the namespace: `"ns::foo()"`, but this is
35 35
#'   usually not needed as it will be inferred from the caller environment.
@@ -58,32 +58,32 @@
Loading
58 58
#'
59 59
#' @examples
60 60
#' # A deprecated function `foo`:
61 -
#' deprecate_warn("1.0.0", "foo()")
61 +
#' deprecate_warn("1.0.0", foo())
62 62
#'
63 63
#' # A deprecated argument `arg`:
64 -
#' deprecate_warn("1.0.0", "foo(arg = )")
64 +
#' deprecate_warn("1.0.0", foo(arg))
65 65
#'
66 66
#' # A partially deprecated argument `arg`:
67 -
#' deprecate_warn("1.0.0", "foo(arg = 'must be a scalar integer')")
67 +
#' deprecate_warn("1.0.0", foo(arg = 'must be a scalar integer'))
68 68
#'
69 69
#' # A deprecated function with a function replacement:
70 -
#' deprecate_warn("1.0.0", "foo()", "bar()")
70 +
#' deprecate_warn("1.0.0", foo(), bar())
71 71
#'
72 72
#' # A deprecated function with a function replacement from a
73 73
#' # different package:
74 -
#' deprecate_warn("1.0.0", "foo()", "otherpackage::bar()")
74 +
#' deprecate_warn("1.0.0", foo(), "otherpackage::bar()")
75 75
#'
76 76
#' # A deprecated function with custom message:
77 77
#' deprecate_warn(
78 78
#'   when = "1.0.0",
79 -
#'   "foo()",
79 +
#'   what = foo(),
80 80
#'   details = "Please use `otherpackage::bar(foo = TRUE)` instead"
81 81
#' )
82 82
#'
83 83
#' # A deprecated function with custom bulleted list:
84 84
#' deprecate_warn(
85 85
#'   when = "1.0.0",
86 -
#'   "foo()",
86 +
#'   what = foo(),
87 87
#'   details = c(
88 88
#'     x = "This is dangerous",
89 89
#'     i = "Did you mean `safe_foo()` instead?"
@@ -96,6 +96,8 @@
Loading
96 96
                           details = NULL,
97 97
                           id = NULL,
98 98
                           env = caller_env(2)) {
99 +
  what <- substitute(what)
100 +
  with <- substitute(with)
99 101
  msg <- lifecycle_message(when, what, with, details, env, "deprecate_soft")
100 102
101 103
  verbosity <- lifecycle_verbosity()
@@ -121,6 +123,8 @@
Loading
121 123
                           details = NULL,
122 124
                           id = NULL,
123 125
                           env = caller_env(2)) {
126 +
  what <- substitute(what)
127 +
  with <- substitute(with)
124 128
  msg <- lifecycle_message(when, what, with, details, env, "deprecate_warn")
125 129
126 130
  verbosity <- lifecycle_verbosity()
@@ -157,6 +161,8 @@
Loading
157 161
                           what,
158 162
                           with = NULL,
159 163
                           details = NULL) {
164 +
  what <- substitute(what)
165 +
  with <- substitute(with)
160 166
  msg <- lifecycle_message(when, what, with, details, env, "deprecate_stop")
161 167
  deprecate_stop0(msg)
162 168
}

@@ -21,12 +21,14 @@
Loading
21 21
}
22 22
23 23
spec_what <- function(what, arg, signaller) {
24 -
  if (!is_string(what)) {
25 -
    lifecycle_abort("`what` must be a string")
24 +
  if (is_call(what)) {
25 +
    call <- what
26 +
  } else if (is_string(what)) {
27 +
    call <- parse_expr(what)
28 +
  } else {
29 +
    lifecycle_abort("`what` must be a string or call.")
26 30
  }
27 31
28 -
  call <- parse_expr(what)
29 -
30 32
  if (!is_call(call)) {
31 33
    what <- as_string(what)
32 34
    lifecycle_abort(
Files Coverage
R 98.07%
Project Totals (10 files) 98.07%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
        informational: true
10
    patch:
11
      default:
12
        target: auto
13
        threshold: 1%
14
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading