Skip to content

context-aware @evalRd? #1309

@MichaelChirico

Description

@MichaelChirico

We've got an Rd helper that takes the name of the attached function as an argument:

https://github.com/r-lib/lintr/blob/ab5ab94b0ef33c7c66f270b4dd2b4b10cea53840/R/class_equals_linter.R#L10-L13

essentially

#' @evalRd rd_tags("class_equals_linter")
class_equals_linter <- function() {
}

This works well, but the problem I've noticed is when we sometimes rename the function, it's easy to forget to update the name twice.

This could be avoided if @evalRd was context aware. I'm thinking like .onLoad / .onAttach get the package/lib name along, the @evalRd execution could "receive" some metadata as well.

I'm not sure the right API for this (maybe it needs to be a new @ token?) but it would save us some inconvenience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions