r-lib / lifecycle

Manage the life cycle of your exported functions and arguments
https://lifecycle.r-lib.org
Other
94 stars 25 forks source link

Example for arg prints incorrect function name #166

Open kellijohnson-NOAA opened 1 year ago

kellijohnson-NOAA commented 1 year ago

The dummy function in the example for lifecycle::deprecated() is called foobar_adder but the call to lifecycle::deprecate_warn() looks like https://github.com/r-lib/lifecycle/blob/9417eca8f5091f95b4569fb6c388e4394e2b2157/R/arg.R#L24 where foo is shown as the package from which bar_adder() comes from rather than a function called foobar_adder(). As is, it results in the user seeing

The `baz` argument of `bar_adder()` is deprecated as of foo 1.0.0.

I believe the line should be

deprecate_warn("1.0.0", "foobar_adder(baz = )", "foobar_adder(bar = )")

but then the user would not see the functionality of which package the function is coming from. Thanks for the great package! I am happy to open a pull request for this but I am honestly not sure if the suggested line above is the best answer.

R Session Info ``` > sessionInfo() R Under development (unstable) (2022-09-18 r82873 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045) Matrix products: default locale: [1] LC_COLLATE=English_United States.utf8 [2] LC_CTYPE=English_United States.utf8 [3] LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.utf8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lifecycle_1.0.3 lubridate_1.9.2 forcats_1.0.0 [4] stringr_1.5.0 dplyr_1.1.0 purrr_1.0.1 [7] readr_2.1.4 tidyr_1.3.0 tibble_3.1.8 [10] ggplot2_3.4.1 tidyverse_2.0.0 PacFIN.Utilities_0.2.6 [13] testthat_3.1.6 devtools_2.4.5 usethis_2.1.6 loaded via a namespace (and not attached): [1] gtable_0.3.1 htmlwidgets_1.6.1 remotes_2.4.2 processx_3.8.0 [5] tzdb_0.3.0 callr_3.7.3 vctrs_0.5.2 tools_4.3.0 [9] ps_1.7.2 generics_0.1.3 fansi_1.0.4 chron_2.3-59 [13] pkgconfig_2.0.3 desc_1.4.2 ggridges_0.5.4 compiler_4.3.0 [17] brio_1.1.3 measurements_1.5.0 munsell_0.5.0 janitor_2.2.0 [21] snakecase_0.11.0 httpuv_1.6.9 htmltools_0.5.4 nwfscSurvey_2.1 [25] later_1.3.0 pillar_1.8.1 crayon_1.5.2 urlchecker_1.0.1 [29] RODBC_1.3-20 ellipsis_0.3.2 cachem_1.0.7 sessioninfo_1.2.2 [33] mime_0.12 tidyselect_1.2.0 digest_0.6.31 stringi_1.7.12 [37] reshape2_1.4.4 cowplot_1.1.1 rprojroot_2.0.3 fastmap_1.1.1 [41] grid_4.3.0 colorspace_2.1-0 cli_3.6.0 magrittr_2.0.3 [45] pkgbuild_1.4.0 utf8_1.2.3 withr_2.5.0 prettyunits_1.1.1 [49] scales_1.2.1 promises_1.2.0.1 timechange_0.2.0 hms_1.1.2 [53] memoise_2.0.1 shiny_1.7.4 miniUI_0.1.1.1 profvis_0.3.7 [57] rlang_1.0.6 Rcpp_1.0.10 xtable_1.8-4 glue_1.6.2 [61] pkgload_1.3.2 rstudioapi_0.14 jsonlite_1.8.4 R6_2.5.1 [65] plyr_1.8.8 fs_1.6.1 ```