| name | tidy-deprecate-function |
| description | Guide for deprecating R functions/arguments. Use when a user asks to deprecate a function or parameter, including adding lifecycle warnings, updating documentation, adding NEWS entries, and updating tests. |
Deprecate functions and function arguments
Use this skill when deprecating functions or function parameters in this package.
Overview
This skill guides you through the complete process of deprecating a function or parameter, ensuring all necessary changes are made consistently:
- Add deprecation warning using
lifecycle::deprecate_warn().
- Silence deprecation warnings in existing tests.
- Add lifecycle badge to documentation.
- Add bullet point to NEWS.md.
- Create test for deprecation warning.
Workflow
Step 1: Determine deprecation version
Read the current version from DESCRIPTION and calculate the deprecation version:
- Current version format:
MAJOR.MINOR.PATCH.9000 (development).
- Deprecation version: Next minor release
MAJOR.(MINOR+1).0.
- Example: If current version is
2.5.1.9000, deprecation version is 2.6.0.
Step 2: Add lifecycle::deprecate_warn() call
Add the deprecation warning to the function:
function_name <- function(...) {
lifecycle::deprecate_warn("X.Y.0"
function_name param1 deprecated_param deprecated
lifecycleis_presentdeprecated_param
lifecycledeprecate_warn