Skip to content

Add argument selection to @inheritParams#1852

Merged
hadley merged 4 commits into
mainfrom
inherit-params-select
Apr 10, 2026
Merged

Add argument selection to @inheritParams#1852
hadley merged 4 commits into
mainfrom
inherit-params-select

Conversation

@hadley
Copy link
Copy Markdown
Member

@hadley hadley commented Apr 6, 2026

Fixes #1849

@maelle another one you might enjoy 😄

Copy link
Copy Markdown
Contributor

@maelle maelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 😸

Comment thread vignettes/reuse.Rmd Outdated
Comment thread vignettes/reuse.Rmd
`@inheritParams` (like all `@inherits` functions) works recursively, so if `g` inherits parameters from `h`, then `f` can also inherit those parameters from `g`. However, this technique is best used sparingly: it's very easy to create complex dependency webs that are hard to reason about where making changing the documentation in one function cascades out in unexpected ways across your package. You can avoid this problem by being more explicit about which parametrs are inherited:

- `@inheritParams foo x y` inherits only `x` and `y`.
- `@inheritParams foo -z` inherits all parameters except `z`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice

next, wild cards?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that leads you right back to the "what the heck is actually getting inherited" problem.

@hadley hadley merged commit 1f009e8 into main Apr 10, 2026
13 checks passed
@hadley hadley deleted the inherit-params-select branch April 10, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support argument filtering in @inheritParams

2 participants